繁体   English   中英

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

[英]How to restart Phusion Passenger + Apache in Production mode on Ubuntu server for Ruby on Rails?

我有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?

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

例如

  touch %RAILS_ROOT%/tmp/restart.txt

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

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

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

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

RAILS_ENV=production rails c

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

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

只是为了使用以下命令启动特定端口的app:

乘客开始-a 0.0.0.0 -p 3000 -d -e生产

我跟着PhusionPassenger文档中列出的命令在这里和他们的工作直掉。

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)

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM