为Jenkins服务器配置添加URL前缀

时间:2014-01-02 16:50:00

标签: apache jenkins

我在自己的网络服务器(带有Apache2的Ubuntu)上运行Jenkins,可以通过dyndns访问。我的目标是使用以下URL访问Jenkins:

https://myPrivateURL.dyndns-office.com:444/jenkins/ 

所以我像这样配置我的Apache:

enter image description here

如果我在浏览器中输入https://myPrivateURL.dyndns-office.com:444/jenkins/,则可以访问Jenkins。但是,并非Jenkins页面中的所有链接都是正确的。例如。考虑左边的菜单条目,包括“新工作”,“管理詹金斯”等:

enter image description here

点击“管理Jenkins”时,服务器会尝试查找以下网址:

 https://myPrivateURL.dyndns-office.com:444/manage 

但是,URL应该包含路径中的“jenkins”。以下网址是正确的(如果手动输入,则有效)

 https://myPrivateURL.dyndns-office.com:444/jenkins/manage 

所以问题出现了:

如何配置Jenkins以便使用前缀来构建Jenkins-URL?这是我试过的:

我打开/ etc / default / jenkins并将“--prefix = / jenkins /”附加到JENKINS_ARGS

enter image description here

但是,如果我在重启Jenkins后尝试打开https://myPrivateURL.dyndns-office.com:444/jenkins/,我总会得到相同的错误消息:

enter image description here

我输入的前缀并不重要。即使我使用“abcdefg”作为前缀,错误消息仍然是相同的。 /var/log/jenkins/jenkins.log只是说

  

[Winstone 2014/01/02 XX:XX:XX] - 请求网址/未找到 - 没有   匹配任何webapp前缀

1 个答案:

答案 0 :(得分:4)

我很亲密:

ProxyPass /jenkins/ http://localhost:8080/
ProxyPassReverse /jenkins/ http://localhost:8080/

必须是

ProxyPass /jenkins/ http://localhost:8080/jenkins/
ProxyPassReverse /jenkins/ http://localhost:8080/jenkins/