Apache-2.2

詹金斯,聲納反向代理

  • December 22, 2015

我正在嘗試讓 jenkins (on /)、sonar (on /sonar) 和 nexus (on /nexus) 啟動並執行。除了詹金斯給我舊的以外,它們似乎都可以工作。看來您的反向代理設置已損壞。

我不明白為什麼。我錯過了一些東西,並且盯著它看太久了。我在做什麼錯/錯過了什麼?

我的 apache 配置如下。正如另一篇文章所建議的那樣,我將最後 2 行添加到 proxyPassReverse 行中以查看是否可以修復它,但它對我不起作用。

地址的“建構”條目在我的主機文件中配置。

編輯:添加了虛擬主機標籤

<VirtualHost *>
 ProxyRequests   Off
 ProxyPreserveHost On
 AllowEncodedSlashes NoDecode
 RequestHeader set X-Forwarded-Proto "https"
 RequestHeader set X-Forwarded-Port "443"

 ProxyPass               /sonar  http://build:9000/sonar nocanon
 ProxyPassReverse        /sonar  http://build:9000/sonar
 ProxyRequests   Off

 ProxyPass               /nexus  http://build:8081/nexus nocanon
 ProxyPassReverse        /nexus  http://build:8081/nexus
 ProxyRequests   Off

 ProxyPass               /       http://build:8080/ nocanon
 ProxyPassReverse        /       http://build:8080/
 ProxyPassReverse        /       https://build:8080/
 ProxyPassReverse        /       http://build/
 ProxyPassReverse        /       https://build/


 ProxyRequests   Off

 <Proxy http://localhost:8080/*>
   Order deny,allow
   Allow from all
 </Proxy>
 <Proxy http://localhost:9000/*>
   Order deny,allow
   Allow from all
 </Proxy>
 <Proxy http://localhost:8081/nexus/*>
   Order deny,allow
   Allow from all
 </Proxy>
</VirtualHost>

編輯:添加捲曲響應:

curl -iL http://192.168.1.108/administrativeMonitor/hudson.diagnosi
HTTP/1.1 302 Found
Date: Mon, 16 Nov 2015 21:29:00 GMT
Server: Jetty(winstone-2.8)
X-Content-Type-Options: nosniff
Location: https://192.168.1.108/administrativeMonitor/hudson.diagnosis.ReversePr
Content-Length: 0

curl: (7) Failed to connect to 192.168.1.108 port 443: Connection refused

編輯:添加了 apache 日誌。(我留下了很多相同的行)

[Mon Nov 16 23:05:42.128539 2015] [proxy:error] [pid 646:tid 140309149226752] (111)Connection refused: AH00957: HTTP: attempt to connect to 127.0.1.1:8080 (build) failed
[Mon Nov 16 23:05:42.128583 2015] [proxy:error] [pid 646:tid 140309149226752] AH00959: ap_proxy_connect_backend disabling worker for (build) for 60s
[Mon Nov 16 23:05:42.128593 2015] [proxy_http:error] [pid 646:tid 140309149226752] [client 192.168.1.102:62221] AH01114: HTTP: failed to make connection to backend: build
[Mon Nov 16 23:05:42.207801 2015] [proxy:error] [pid 645:tid 140309166012160] AH00940: HTTP: disabled connection for (build)
[Mon Nov 16 23:06:31.146140 2015] [proxy:error] [pid 646:tid 140309124048640] AH00940: HTTP: disabled connection for (build)
[Mon Nov 16 23:06:31.312161 2015] [proxy:error] [pid 646:tid 140309115655936] AH00940: HTTP: disabled connection for (build)
[Tue Nov 17 06:37:41.189136 2015] [mpm_event:notice] [pid 643:tid 140309369055104] AH00493: SIGUSR1 received.  Doing graceful restart
AH00558: apache2: Could not reliably determine the server's fully qualified domain name, using 127.0.1.1. Set the 'ServerName' directive globally to suppress this message

線索是將 Jenkins 首頁 url 配置為 http://…

這將使 jenkins 的反向代理測試走上正確的道路。當然,如果您想要 https,請添加 s :)

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