这个问题是否与 jenkins、java 或 apache 有关。但是由于我重新启动了服务器,我的 jenkins.example.com 返回了 503 服务不可用。
我尝试了什么
重新启动 jenkins,重新启动 apache,重新安装 jenkins。
重新启动 jenkins 时,我能够看到 jenkins 的默认安装页面,但它在几秒钟后返回了 503。
我的设置
这是我的 apache.conf
<VirtualHost *:80>
ServerAdmin webmaster@localhost
ServerName jenkins.example.com
ServerAlias jenkins
RewriteEngine On
RewriteCond %{HTTPS} off
RewriteRule (.*) https://%{SERVER_NAME}/$1 [R,L]
</VirtualHost>
和 apache-ssl.conf
<IfModule mod_ssl.c>
<VirtualHost *:443>
ServerAdmin webmaster@localhost
ServerName jenkins.example.com
ServerAlias jenkins
ProxyRequests Off
<Proxy *>
Order deny,allow
Allow from all
</Proxy>
ProxyPreserveHost on
ProxyPass / http://localhost:8081/ retry=0 timeout=5 nocanon
ProxyPassReverse / http://localhost:8081
AllowEncodedSlashes NoDecode
RequestHeader set X-Forwarded-Proto "https"
RequestHeader set X-Forwarded-Port "443"
SSLCertificateFile /home/staff/x.example.com.crt
SSLCertificateKeyFile /home/staff/x.example.com.key
</VirtualHost>
这也是我的阿帕奇错误.log
[Wed Mar 21 10:59:16.798407 2018] [proxy:error] [pid 6611] (111)Connection refused: AH00957: HTTP: attempt to connect to 127.0.0.1:8081 (localhost) failed
[Wed Mar 21 10:59:16.798481 2018] [proxy_http:error] [pid 6611] [client xx.xxx.xx.xx:xxxxx] AH01114: HTTP: failed to make connection to backend: localhost
该服务器还安装了 phabricator 在重新启动后运行良好。只有詹金斯似乎崩溃了。
固定!
在新服务器下修复了重新安装 jenkins 的问题。我认为这是已经安装在同一台服务器中的phabricator的错误。现在在新服务器下,即使我重新启动服务器,jenkins 也会显示在 jenkins.example.com
您需要将jenkins
配置为在proxy
下工作。为此,请点击此链接。我还没有自己尝试过这个。但看起来很有希望。还有更多教程可以在代理下配置 jenkins。希望这能解决您的问题。
通过在新服务器下重新安装 jenkins 来解决此问题。我认为这是已经安装在同一台服务器中的phabricator的错误。现在在新服务器下,即使我重新启动服务器,jenkins 也会显示在 jenkins.example.com