2013-05-12 87 views
8

當Phusion Passenger已經運行時(在我的情況下是Nginx),是否可以升級到新版本?升級Phusion Passenger而無需重新安裝Nginx

我使用passenger-install-nginx-module安裝Passenger 4.0.0.rc6。我的Nginx配置現在包含

passenger_root /usr/local/lib/ruby/gems/2.0.0/gems/passenger-4.0.rc6; 
passenger_ruby /usr/local/bin/ruby; 

現在我想升級到Passenger 4.0.2。我可以安裝gem,但是當我再次運行passenger-install-nginx-module時,它會嘗試重新編譯並重新安裝Nginx。 (我認爲這將是如此聰明,發現已經有一個安裝的Nginx的位置我指定使用--prefix

我試圖手動更改passenger_root新客運寶石的位置,但我得到了Nginx的以下錯誤錯誤日誌:

2013/05/12 12:30:13 [alert] 14298#0: Unable to start the Phusion Passenger watchdog because its executable (/usr/local/lib/ruby/gems/2.0.0/gems/passenger-4.0.2/agents/PassengerWatchdog) does not exist. This probably means that your Phusion Passenger installation is broken or incomplete, or that your 'passenger_root' directive is set to the wrong value. Please reinstall Phusion Passenger or fix your 'passenger_root' directive, whichever is applicable. (-1: Unknown error) 

顯然運行passenger-install-nginx-modulePassengerWatchdog建成。我不想複製舊版寶石中的PassengerWatchdog,因爲可能發生了變化。

那麼...什麼是升級乘客沒有重新編譯和重新安裝Nginx(或Apache)的正確方法?

+1

你確定它試圖重新安裝Nginx嗎?插件必須在更新後重新編譯是正常的。我不認爲這會影響整個服務器。 – Wukerplank 2013-05-12 14:46:03

回答

17

@ Wukerplank的評論讓我走上了正軌。再次運行passenger-install-nginx-module,當我檢查的輸出和它說:

Nginx doesn't support loadable modules such as some other web servers do, 
so in order to install Nginx with Passenger support, it must be recompiled. 

Do you want this installer to download, compile and install Nginx for you? 

1. Yes: download, compile and install Nginx for me. (recommended) 
    The easiest way to get started. A stock Nginx 1.4.1 with Passenger 
    support, but with no other additional third party modules, will be 
    installed for you to a directory of your choice. 

2. No: I want to customize my Nginx installation. (for advanced users) 
    Choose this if you want to compile Nginx with more third party modules 
    besides Passenger, or if you need to pass additional options to Nginx's 
    'configure' script. This installer will 1) ask you for the location of 
    the Nginx source code, 2) run the 'configure' script according to your 
    instructions, and 3) run 'make install'. 

Whichever you choose, if you already have an existing Nginx configuration file, 
then it will be preserved. 

最重要的部分在於Nginx已經重新編譯與客運工作,和現有的Nginx的配置被保留。

所以升級乘客的正確方法是

  1. 安裝新的客運寶石
  2. 完全相同的參數在第一時間(所以同樣的Nginx的版本和模塊執行passenger-install-nginx-module被編譯,這是安裝在同一目錄中等)
  3. 安裝前,檢查它是否顯示「歡迎使用Phusion Passenger Nginx模塊安裝程序v4.0.2」。 (在我的情況下爲4.0.2)
  4. 安裝Nginx之後,將您現有的Nginx conf(path/to/nginx/conf/nginx.conf)中的passenger_root更改爲指向新的gem版本(只需更換與新老版本號)
  5. 重啓Nginx的
  6. 利潤
5

你可以不重新編譯Nginx的升級。完整的升級說明可在the Phusion Passenger for Nginx manual中找到。從手冊:

Nginx是一個不同於其他網絡服務器,因爲它不支持可加載模塊。擴展Nginx的唯一方法是完全從源代碼重新編譯它。由於Phusion Passenger由一些外部可執行文件和一個Nginx模塊組成,因此您必須在首次安裝Phusion Passenger時重新編譯Nginx,而且在升級Nginx本身或升級Phusion Passenger版本時也必須重新編譯。

重新編譯Nginx和Phusion Passenger可執行文件是我們在這一步中要做的。好消息是Phusion Passenger提供了一個工具讓你輕鬆實現。

如果您之前已經安裝了Nginx,但沒有Phusion Passenger支持,那麼您應該首先卸載它。你不需要,因爲你也可以安裝另一個帶有Phusion Passenger支持的Nginx,與現有的Nginx並行。我們只是建議卸載現有的,以避免用戶混淆,但選擇是你的。

如果您之前已經安裝了帶有Phusion Passenger支持的Nginx,並且您正在升級,那麼您不必先卸載現有的Nginx。相反,我們會覆蓋這一步。但重要的是,您需要使用上次使用的配置參數重新編譯Nginx。

+1

感謝您的回答,@鴻利。我接受了我自己的答案,因爲我包含了我必須採取的重新安裝Nginx Passenger的具體步驟。 – 2013-05-14 14:37:24

相關問題