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.