1. 程式人生 > >Rails啟動Nginx提示找不到PassengerAgent的解決

Rails啟動Nginx提示找不到PassengerAgent的解決

因為前不久用gem uninstall -a命令刪除了不少gem,所以更多相關的系統元件都精神不太正常 ;(

按照往常一樣啟動ngxin,可是這次報錯:

sudo nginx
nginx: [alert] Unable to start Phusion Passenger: Support binary PassengerAgent not found (tried: /Users/apple/.rvm/gems/ruby-2.2.5/gems/passenger-5.1.1/buildout/support-binaries/PassengerAgent and /var/root/.passenger/support-binaries/5.1
.1/PassengerAgent). There may be different causes for this: - Your 'passenger_root' setting is set to the wrong value. Please see https://www.phusionpassenger.com/library/config/nginx/reference/#passenger_root to learn how to fix the value. - The PassengerAgent binary is not compiled. Please run this command to
compile it: /Users/apple/.rvm/gems/ruby-2.2.5/gems/passenger-5.1.1/bin/passenger-config compile-agent - Your Passenger installation is broken or incomplete. Please reinstall Passenger. (-1: Unknown error)

進入gens目錄檢視passenger-5.1.1的各種檔案,都正常,但唯獨缺少了PassengerAgent !這個檔案是用原始碼在本機上編譯連結出來的,從出錯日誌看之前存在於:

/Users/apple/
.rvm/gems/ruby-2.2.5/gems/passenger-5.1.1/buildout/support-binaries/PassengerAgent 或 /var/root/.passenger/support-binaries/5.1.1/PassengerAgent)

目錄.可能是gem刪除將其刪掉了.我們直接重新編譯吧:

/Users/apple/.rvm/gems/ruby-2.2.5/gems/passenger-5.1.1/bin/passenger-config compile-agent

大概花了幾分鐘完成了,可尷尬的是不知道生成的檔案放到了哪裡?沒有任何提示…

那麼直接暴力搜一下吧:

find ~/.rvm PassengerAgent|grep PassengerAgent
只找到一個檔案路徑:
/Users/apple/.passenger/support-binaries/5.1.1/PassengerAgent

我們根據出錯日誌手動建立對應的路徑然後將它copy進去後一切正常了.