Windows 10上针对Jenkins的NGINX反向代理 [英] NGINX reverse proxy for Jenkins on a Windows 10
问题描述
因此,我查看了有关该主题的所有教程,但没有任何效果. 我在Windows 10专业版上有一个JENKINS实例,在Nginx上有一个centos. 我想将NGINX用作Jenkins的反向代理,以具有https并使其可从Internet访问. 我当前的配置是:
So I have looked at all the tutorials that I could found on this topic, and nothing worked. I have a JENKINS instance on a windows 10 pro, and a centos with nginx. I want to use the NGINX as reverse proxy for Jenkins, to have https and make it accessible from internet. My current configuration is:
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错误的网关. 出现以下错误: 连接到上游时,connect()到192.XXX:8080失败(13:权限被拒绝),客户端:192.168.5.254,服务器:build.test.com,请求:"GET/jenkins HTTP/1.1",上游:" http://192.XXX:8080/,托管:" build.test.com"
(I replaced the real url and IPs.) But this gave me a 502 Bad Gateway. With the following error: connect() to 192.X.X.X:8080 failed (13: Permission denied) while connecting to upstream, client: 192.168.5.254, server: build.test.com, request: "GET /jenkins HTTP/1.1", upstream: "http://192.X.X.X:8080/", host: "build.test.com"
但是在我的本地网络上,当我尝试使用 http://192.XXX:8080/访问服务器时网址,它可以正常工作. 有什么主意吗?
But on my local network when I try to access the server with the http://192.X.X.X:8080/ url, it works fine. Any idea ?
谢谢
推荐答案
进行一些研究表明,这很可能是CentOS(尤其是SELinux)内部的问题. SELinux可能会在许多地方导致该问题.但是,这可能是一个很好的起点: https://stackoverflow.com/a/24830777/8680186
Doing a little bit of research indicates that this is most likely an issue within CentOS, and more specifically, SELinux. SELinux could be causing the problem in any number of locations; however, this is probably going to be a good jumping off point: https://stackoverflow.com/a/24830777/8680186
检查SELinux日志以找出为什么如果以上方法无济于事,为什么会抛出嘶哑的感觉.
Check the SELinux logs to figure out why it's throwing a hissy fit if the above doesn't help.
这篇关于Windows 10上针对Jenkins的NGINX反向代理的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!