所以我查看了我在这个主题上找到的所有教程,但没有任何效果。 我在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
}
}
(我替换了真实的网址和IP。) 但这给了我一个502 Bad Gateway。 出现以下错误: 连接到上游时连接()到192.XXX:8080失败(13:权限被拒绝),客户端:192.168.5.254,服务器:build.test.com,请求:“GET / jenkins HTTP / 1.1”,上游:“{ {3}}“,主持人:”build.test.com“
但是当我尝试使用http://192.X.X.X:8080/网址访问服务器时,在我的本地网络上,它运行正常。 有什么想法吗?
由于
答案 0 :(得分:0)
进行一些研究表明,这很可能是CentOS中的一个问题,更具体地说是SELinux。 SELinux可能导致任何位置的问题;然而,这可能是一个很好的跳跃点:https://stackoverflow.com/a/24830777/8680186
检查SELinux日志,如果以上情况没有帮助,请弄清楚它为什么会出现异议。