【发布时间】:2018-05-28 20:33:30
【问题描述】:
所以我查看了我能找到的关于这个主题的所有教程,但没有任何效果。 我在 windows 10 pro 上有一个 JENKINS 实例,还有一个带有 nginx 的 centos。 我想使用 NGINX 作为 Jenkins 的反向代理,拥有 https 并使其可以从互联网访问。 我目前的配置是:
server {
listen 80;
listen [::]:80;
server_name build.test.com;
access_log /var/log/nginx/log/build.test.com.access.log main;
error_log /var/log/nginx/log/build.test.com.error.log;
location ^~ /jenkins/ {
proxy_pass http://192.X.X.X:8080/;
proxy_redirect http://192.X.X.X:8080 http://build.test.com;
sendfile off;
proxy_set_header Host $host:$server_port;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_max_temp_file_size 0;
#this is the maximum upload size
client_max_body_size 10m;
client_body_buffer_size 128k;
proxy_connect_timeout 90;
proxy_send_timeout 90;
proxy_read_timeout 90;
proxy_temp_file_write_size 64k;
# Required for new HTTP-based CLI
proxy_http_version 1.1;
proxy_request_buffering off;
proxy_buffering off; # Required for HTTP-based CLI to work over SSL
}
}
(我替换了真实的 url 和 IP。) 但这给了我一个 502 Bad Gateway。 出现以下错误: connect() to 192.XXX:8080 failed (13: Permission denied) 同时连接到上游,客户端:192.168.5.254,服务器:build.test.com,请求:“GET /jenkins HTTP/1.1”,上游:“@ 987654321@",主机:"build.test.com"
但是在我的本地网络上,当我尝试使用http://192.X.X.X:8080/ url 访问服务器时,它工作正常。 有什么想法吗?
谢谢
【问题讨论】:
标签: nginx jenkins proxy centos