NGINX代理http:// host / jenkins到http:// host:8080

时间:2018-03-28 15:29:29

标签: nginx jenkins

我尝试使用NGINX作为Jenkins服务器的反向代理。基本上,当在浏览器中打开http://host/jenkins时,NGINX应该将请求代理到J​​enkins正在监听的http://host:8080

我尝试了各种不同的配置,但没有一个真正有用。这是我目前使用的位置配置。它以某种方式工作,但没有显示任何图像等。

location /jenkins/ {
  proxy_set_header Host $http_host;
  proxy_set_header X-Real-IP $remote_addr;
  proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
  proxy_set_header X-Forwarded-Proto $scheme;
  proxy_pass          http://localhost:8080/;
  proxy_read_timeout  90s;
  # Fix potential "It appears that your reverse proxy set up is broken" error.
  proxy_redirect      http://localhost:8080/ https://host/jenkins/;
}

1 个答案:

答案 0 :(得分:1)

确保更新Jenkins配置

JENKINS_ARGS="--webroot=/var/cache/jenkins/war --httpPort=$HTTP_PORT --ajp13Port=$AJP_PORT --prefix=/jenkins"

取自https://wiki.jenkins.io/display/JENKINS/Jenkins+behind+an+NGinX+reverse+proxy