如何在Ubuntu服务器上为Ruby on Rails重启Phusion Passenger + Apache的生产模式?

时间:2013-03-12 17:51:00

标签: ruby-on-rails ruby-on-rails-3 apache passenger

我有Apache + phusion乘客,我已经把

RailsEnv production

在/ etc / apache2 / sites-available / default文件中并重新启动了apache但是在我运行时

rails c
> Rails.env.production?

它给出了

的故障
> Rails.env.development?

它给出了真实。还有其他方法可以重新启动乘客,因为我认为将“RailsEnv生产”置于默认状态是正确的方法吗?顺便说一句我正在使用

sudo service apache2 restart

如何使用passenger + apache在生产模式下在rails应用程序上启动我的ruby?

4 个答案:

答案 0 :(得分:23)

只需在你的应用的tmp目录中创建一个restart.txt

e.g。

  touch %RAILS_ROOT%/tmp/restart.txt

看这里 http://www.modrails.com/documentation/Users%20guide%20Apache.html第3.3节

答案 1 :(得分:3)

您的应用可能已处于生产模式。

默认情况下,rails c会以开发模式加载应用。

如果您希望在生产模式下启动控制台,请执行以下操作:

RAILS_ENV=production rails c

控制台和Web应用程序是两个不同的rails进程并独立运行。

您应该检查您的production.log文件,以确保您的应用程序在生产中运行。

答案 2 :(得分:3)

仅用于在命令下使用特定端口启动应用程序:

乘客开始-a 0.0.0.0 -p 3000 -d -e production

答案 3 :(得分:2)

我按照PhusionPassenger docs here中列出的命令进行了直接工作。

deployer@staging:~$ passenger-config restart-app
Please select the application to restart.
Tip: re-run this command with --help to learn how to automate it.
If the menu doesn't display correctly, press '!'

 ‣   /home/deployer/myapp/current (staging)
     /home/deployer/myapp_2/current (staging)
     Cancel

Restarting /home/deployer/myapp/current (staging)

deployer@staging:~$ passenger-config restart-app
Please select the application to restart.
Tip: re-run this command with --help to learn how to automate it.
If the menu doesn't display correctly, press '!'

     /home/deployer/myapp/current (staging)
 ‣   /home/deployer/myapp_2/current (staging)
     Cancel

Restarting /home/deployer/myapp_2/current (staging)
相关问题