我正在将我的ubuntu服务器(Ubuntu 18.04.1 LTS)设置为运行Jenkins,我已经成功设置了nginx config来运行confluence和jira,但是我无法弄清楚问题出在jenkins,就像我每次尝试一样访问它,会导致502错误的网关
我在/etc/nginx/sites-available/bla
和/etc/default/jenkins
尝试了多种配置,它们引用了不同的线程,但是它们似乎都不起作用。
/ etc / nginx / sites-available
location /{
try_files $uri $uri/ =404;
}
location /confluence {
proxy_set_header X-Forwarded-Host $host;
proxy_set_header X-Forwarded-Server $host;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_pass http://localhost:8090/confluence;
client_max_body_size 10M;
}
location /jira {
proxy_set_header X-Forwarded-Host $host;
proxy_set_header X-Forwarded-Server $host;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_pass http://localhost:8080/jira;
client_max_body_size 10M;
}
location /jenkins {
proxy_set_header X-Forwarded-Host $host;
proxy_set_header X-Forwarded-Server $host;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_pass http://localhost:9999/jenkins;
}
/ etc / default / jenkins
# port for HTTP connector (default 8080; disable with -1)
HTTP_PORT=9999
HTTP_HOST=127.0.0.1
JENKINS_ARGS="--webroot=/var/cache/$NAME/war --httpPort=$HTTP_PORT --httpListenAddress=$HTTP_HOST --ajp13Port=$AJP_PORT --prefix=/jenkins"
/var/log/nginx/error.log
2019/02/14 10:48:07 [crit] 32131#32131: connect() failed (22: Invalid argument) while resolving, resolver: 0.0.34.184:53
2019/02/14 10:48:10 [error] 32131#32131: *260 connect() failed (111: Connection refused) while connecting to upstream, client: 165.225.114.95, server: bla.co.nz, request: "GET /jenkins HTTP/2.0", upstream: "http://[::1]:9999/jenkins", host: "bla.co.nz"
2019/02/14 10:48:10 [error] 32131#32131: *260 connect() failed (111: Connection refused) while connecting to upstream, client: 165.225.114.95, server: bla.co.nz, request: "GET /jenkins HTTP/2.0", upstream: "http://127.0.0.1:9999/jenkins", host: "bla.co.nz"
ufw状态
To Action From
-- ------ ----
Nginx Full ALLOW Anywhere
OpenSSH ALLOW Anywhere
80 ALLOW Anywhere
443 ALLOW Anywhere
9090 ALLOW Anywhere
9999 ALLOW Anywhere
Nginx Full (v6) ALLOW Anywhere (v6)
OpenSSH (v6) ALLOW Anywhere (v6)
80 (v6) ALLOW Anywhere (v6)
443 (v6) ALLOW Anywhere (v6)
9090 (v6) ALLOW Anywhere (v6)
9999 (v6) ALLOW Anywhere (v6)
bla.co.nz/jenkins
时,我应该可以访问