我正在尝试启动并运行 jenkins (on /)、sonar (on /sonar) 和 nexus (on /nexus)。它们似乎可以正常工作,但 Jenkins 给我的旧信息似乎表明您的反向代理设置已损坏。
我不明白为什么。我错过了一些东西,而且盯着它看了太久。我做错了什么/错过了什么?
我的 apache 配置如下。我按照另一篇帖子的建议,将最后 2 行添加到 proxyPassReverse 行,看看是否能修复此问题,但对我来说不起作用。
该地址的“build”条目在我的hosts文件中配置。
编辑:添加了虚拟主机标签
<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 响应:
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
答案1
线索是将 Jenkins 主页 url 配置为 http://...
这将使 jenkins 的反向代理测试遵循正确的路径。当然,如果你想要 https,请添加 s :)