Jenkins应用程序在服务器重启后在代理下运行返回503

时间:2018-03-21 10:13:39

标签: apache jenkins proxy

我不知道问题是否与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>

这也是我的apache error.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下

2 个答案:

答案 0 :(得分:1)

您需要将jenkins配置为在proxy下工作。要做到这一点,请关注this link。我自己没有试过这个。但看起来很有希望有更多的教程可以在代理下配置jenkins。希望这能解决您的问题。

答案 1 :(得分:0)

通过在新服务器下重新安装jenkins来解决此问题。我认为phabricator已经安装在同一台服务器上是一个错误。现在在新服务器下,即使我重新启动服务器,jenkins也会显示在jenkins.example.com下