2016-01-02 48 views
-1

我的PHP應用程序工作正常,但有時我得到正是我應該在haproxy.cfg做什麼

504網關超時服務器沒有及時響應。

即使我重新啓動應用程序,我也無法擺脫這個問題。

的HAProxy的日誌:

[WARNING] 001/175903 (47931) : Server express/local-gear is DOWN, reason: Layer4 timeout, check duration: 2000ms. 0 active and 0 backup servers left. 0 sessions active, 0 requeued, 0 remaining in queue. 
[ALERT] 001/175903 (47931) : proxy 'express' has no server available! 
[WARNING] 001/175933 (47931) : Server express/local-gear is UP, reason: Layer7 check passed, code: 302, info: "HTTP status check returned code <3C>302<3E>", check duration: 9ms. 1 active and 0 backup servers online. 0 sessions requeued, 0 total in queue. 
[WARNING] 001/180043 (47931) : Server express/local-gear is DOWN, reason: Layer4 timeout, check duration: 2001ms. 0 active and 0 backup servers left. 1 sessions active, 0 requeued, 0 remaining in queue. 
[ALERT] 001/180043 (47931) : proxy 'express' has no server available! 
[WARNING] 001/180113 (47931) : Server express/local-gear is UP, reason: Layer7 check passed, code: 302, info: "HTTP status check returned code <3C>302<3E>", check duration: 19ms. 1 active and 0 backup servers online. 0 sessions requeued, 0 total in queue. 

我互聯網上找到解決辦法就是做在haproxy.cfg option httpchk GET的變化,但不知道到底是我應該做的。

我的應用程序位於@/app-root/repo/php文件夾那裏我有index.php我也有api文件夾來訪問我的應用程序api。

回答

0

如果您想編輯您的haproxy.cfg,您可以通過rhc ssh <yourApp>將您的應用程序打開並編輯~/haproxy/conf/haproxy.cfg文件來實現。但是,請注意,自定義haproxy配置不受支持,所以我建議在進行任何更改之前備份文件,以防需要恢復默認配置。

更改任何配置後,請執行rhc app-restart <yourApp>以重新啓動應用程序。

+0

當然,但我應該在選項httpchk GET做什麼?我應該寫什麼鏈接 – Fshamri

+0

我認爲你正在試圖找到你想要改變URI的文件,根據上述解決方案的一些說明(也許你可以在你的問題中鏈接這些)。我個人沒有經驗微調httpchk配置值,也許別人可以發表評論。但是,您是否注意到504僅在您的設備由於不活動而閒置後纔會發生? (只有免費帳戶的齒輪正在閒置)您可以在[網絡界面](https://openshift.redhat.com/app/console/applications) - >您的應用程序 - 訪問應用程序之前檢查齒輪是否空轉 - >狀態(空閒/已啓動)。 –