问题
My app is running on this stack:
Ubuntu 12.04.3 nginx 1.4.4 passenger 4.0.33 rvm 1.25.12 ruby 2.1.0p0
nginx.conf file:
http {
passenger_root /usr/local/rvm/gems/ruby-2.1.0/gems/passenger-4.0.33;
passenger_ruby /usr/local/rvm/wrappers/ruby-2.1.0/ruby;
server {
listen 80;
server_name redacted;
root /home/deploy/apps/redacted/current/public;
passenger_enabled on;
passenger_app_env staging;
}
}
When I try to start the app, it fails because it starts in the production environment and I have no database.yml entry for production, only for staging.
How can I get my app to start in staging? I also have other apps running on the same VM in production mode, so I can't blanket set the env['RACK_ENV'] or env['RAILS_ENV'].
回答1:
I just ran into the same issue, the solution was to specify the environment in the nginx config file: rails_env "staging";
You might want to put staging
in quotes on your config.
来源:https://stackoverflow.com/questions/21554402/cant-get-passenger-to-start-rails-4-app-in-staging-environment