无法在过渡环境中让乘客启动Rails 4应用 [英] Can't get Passenger to start Rails 4 app in staging environment

查看:57
本文介绍了无法在过渡环境中让乘客启动Rails 4应用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的应用程序正在此堆栈上运行:

My app is running on this stack:

Ubuntu 12.04.3 nginx 1.4.4 旅客4.0.33 rvm 1.25.12 红宝石2.1.0p0

Ubuntu 12.04.3 nginx 1.4.4 passenger 4.0.33 rvm 1.25.12 ruby 2.1.0p0

nginx.conf文件:

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;
  }
}

当我尝试启动该应用程序时,它失败了,因为它是在生产环境中启动的,并且我没有用于生产的database.yml条目,仅用于登台.

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.

如何让我的应用开始登台?我还以生产模式在同一台VM上运行了其他应用程序,因此无法覆盖设置env ['RACK_ENV']或env ['RAILS_ENV'].

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'].

推荐答案

我遇到了同样的问题,解决方案是在nginx配置文件中指定环境:

I just ran into the same issue, the solution was to specify the environment in the nginx config file: rails_env "staging";

您可能想在配置中的引号中加上staging.

You might want to put staging in quotes on your config.

这篇关于无法在过渡环境中让乘客启动Rails 4应用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆