RailsEnv/PassengerAppEnv being ignored

227 views
Skip to first unread message

blechn...@gmail.com

unread,
Nov 7, 2014, 11:30:11 AM11/7/14
to phusion-...@googlegroups.com
I'm setting up a Rails app on our staging server and have run into a problem with RailsEnv/PassengerAppEnv being ignored.

Ruby 2.1.3
Rails 4.1.5
Passenger 4.0.53 installed as a gem
Ubuntu 12.04
Apache 2.2.22

apache2.conf includes the following at the end:
LoadModule passenger_module /usr/local/rvm/gems/ruby-2.1.3/gems/passenger-4.0.53/buildout/apache2/mod_passenger.so
<IfModule mod_passenger.c>
   
PassengerRoot /usr/local/rvm/gems/ruby-2.1.3/gems/passenger-4.0.53
   
PassengerDefaultRuby /usr/local/rvm/gems/ruby-2.1.3/wrappers/ruby
   
PassengerAppEnv dev
   
RailsEnv dev
</IfModule>



The application is run as a vhost. The vhost.conf:
<VirtualHost *:80>
    ServerAdmin root@dev
    DocumentRoot /var/www/itacademy_new/html/public
    RailsEnv dev
   
<Directory "/var/www/itacademy_new/html/public">
       Options FollowSymLinks -MultiViews
       AllowOverride AuthConfig FileInfo
       Order allow,deny
       Allow from all
       RailsEnv dev
   
</Directory>
   Alias /usage /var/www/itacademy_new/usage
   
<Location /usage>
        Order allow,deny
        Allow from all
   
</Location>
    ServerName itacademy_new.lw-dev
    ErrorLog /var/www/itacademy_new/logs/error_log
    CustomLog /var/www/itacademy_new/logs/access_log combined
</VirtualHost>



It looks to me like everything installed fine, but when I try to load the app in the browser, I get a 500 and the log only tells me "Premature end of script headers:" (nothing after the colon). When I run rake db:migrate, it errors out because it tries to use the development configuration instead of the dev configuration (potentially confusing naming, I know, but it works for our situation).  Nowhere in the code itself is the environment hardcoded to development (or anything else).

I've tried setting PassengerAppEnv, RailsEnv, and RackEnv all by themselves or in cobmination and nothing has worked.

Hongli Lai

unread,
Nov 10, 2014, 7:41:05 AM11/10/14
to phusion-passenger
Can you add an "abort" call to your config.ru? That way, Phusion
Passenger will display an error page during application startup. In
this error page you can see the settings that Phusion Passenger are
using. Can you double check whether the RAILS_ENV value is correctly
set to "dev"?
> --
> You received this message because you are subscribed to the Google Groups
> "Phusion Passenger Discussions" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to phusion-passen...@googlegroups.com.
> To post to this group, send email to phusion-...@googlegroups.com.
> Visit this group at http://groups.google.com/group/phusion-passenger.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/phusion-passenger/ed3dd08c-17db-46a7-8970-c377bd2d58af%40googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.



--
Phusion | Web Application deployment, scaling, and monitoring solutions

Web: http://www.phusion.nl/
E-mail: in...@phusion.nl
Chamber of commerce no: 08173483 (The Netherlands)

blechn...@gmail.com

unread,
Nov 10, 2014, 10:17:36 AM11/10/14
to phusion-...@googlegroups.com, hon...@phusion.nl
Thanks!  I added the abort statement and on the error page it does indeed say the environment is set to "dev", but my app just doesn't seem to pick it up.
Reply all
Reply to author
Forward
0 new messages