Apache-2.2

Apache ReverseProxy 502 到本地詹金斯程序

  • March 13, 2013

我有 apache 在埠 443 上偵聽執行 https 並執行 ProxyPass 返回到同一伺服器上的獨立 jenkins 程序。

大多數時候,這工作正常,但它經常產生 502 錯誤。我可以通過載入詹金的網頁並讓它自動刷新來重現這一點。通常在這樣做的 20 分鐘內,我可以得到一個 502 頁面。

我在 Apache 中啟用了調試日誌記錄,並在下面提供了我的 config + apache 日誌。Jenkins 日誌沒有顯示任何內容(就像它從未收到請求一樣)。

我需要更多的指示來追踪這個問題(並最終解決)。

Apache/2.2.3 詹金斯版。1.451

   <Location />
   ProxyPass http://jenkins.example.com:8080/
   ProxyPassReverse http://jenkins.example.com:8080/
   </Location>


/usr/lib/jvm/jre-1.6.0/bin/java -Dcom.sun.akuma.Daemon=daemonized -Djava.awt.headless=true -DJENKINS_HOME=/var/lib/jenkins -jar /usr/lib/jenkins/jenkins.war --logfile=/var/log/jenkins/jenkins.log --daemon --httpPort=8080 --ajp13Port=8009 --debug=5 --handlerCountMax=100 --handlerCountMaxIdle=20

我自己得到錯誤: 192.168.186.207 - - [13/Mar/2013:09:23:16 -0400] "GET /?auto_refresh=true HTTP/1.1" 502 473

[Wed Mar 13 09:23:16 2013] [info] Initial (No.1) HTTPS request received for child 10 (server jenkins.example.com:443)
[Wed Mar 13 09:23:16 2013] [debug] mod_proxy_http.c(56): proxy: HTTP: canonicalising URL //jenkins.example.com:8080/
[Wed Mar 13 09:23:16 2013] [debug] proxy_util.c(1505): [client 192.168.186.207] proxy: http: found worker http://jenkins.example.com:8080/ for http://jenkins.example.com:8080/?auto_re
fresh=true, referer: https://jenkins.example.com/?auto_refresh=true
[Wed Mar 13 09:23:16 2013] [debug] mod_proxy.c(986): Running scheme http handler (attempt 0)
[Wed Mar 13 09:23:16 2013] [debug] mod_proxy_http.c(1982): proxy: HTTP: serving URL http://jenkins.example.com:8080/?auto_refresh=true
[Wed Mar 13 09:23:16 2013] [debug] proxy_util.c(2007): proxy: HTTP: has acquired connection for (jenkins.example.com)
[Wed Mar 13 09:23:16 2013] [debug] proxy_util.c(2063): proxy: connecting http://jenkins.example.com:8080/?auto_refresh=true to jenkins.example.com:8080
[Wed Mar 13 09:23:16 2013] [debug] proxy_util.c(2189): proxy: connected /?auto_refresh=true to jenkins.example.com:8080
[Wed Mar 13 09:23:16 2013] [error] [client 192.168.186.207] (104)Connection reset by peer: proxy: error reading status line from remote server jenkins.example.com, referer: https://jenkins.example.com/?auto_refresh=true
[Wed Mar 13 09:23:16 2013] [debug] mod_proxy_http.c(1484): [client 192.168.186.207] proxy: NOT Closing connection to client although reading from backend server jenkins.example.com failed., r
eferer: https://jenkins.example.com/?auto_refresh=true
[Wed Mar 13 09:23:16 2013] [error] [client 192.168.186.207] proxy: Error reading from remote server returned by /, referer: https://jenkins.example.com/?auto_refresh=true
[Wed Mar 13 09:23:16 2013] [debug] proxy_util.c(2025): proxy: HTTP: has released connection for (jenkins.example.com)
[Wed Mar 13 09:23:16 2013] [debug] ssl_engine_kernel.c(1823): OpenSSL: Write: SSL negotiation finished successfully
[Wed Mar 13 09:23:16 2013] [info] [client 192.168.186.207] Connection closed to child 10 with standard shutdown (server jenkins.example.com:443)
[Wed Mar 13 09:23:17 2013] [info] [client 192.168.186.207] Connection to child 7 established (server jenkins.example.com:443)

“502”表示後端伺服器有問題,而不是 Apache。您還可以在日誌中看到這一點:

[Wed Mar 13 09:23:16 2013] [error] [client 192.168.186.207] (104)Connection reset by peer:       proxy: error reading status line from remote server jenkins.example.com, referer: https://jenkins.example.com/?auto_refresh=true

掛在 apache 伺服器上的是您的 Jenkins 伺服器。如果您直接在 Jenkins 實例(埠 8080)上執行此操作,請嘗試是否也出現問題。

引用自:https://serverfault.com/questions/487478