簡體   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