Can't get Passenger to start Rails 4 app in staging environment

笑着哭i 提交于 2019-12-08 10:00:27

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!