gpt4 book ai didi

Windows 10 上 Jenkins 的 NGINX 反向代理

转载 作者:太空宇宙 更新时间:2023-11-03 17:23:28 24 4
gpt4 key购买 nike

所以我查看了我能找到的关于这个主题的所有教程,但没有任何效果。我在 windows 10 pro 上有一个 JENKINS 实例,在 centos 上有一个 nginx。我想使用 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。出现以下错误: 连接到 192.X.X.X:8080 失败(13:权限被拒绝),同时连接到上游,客户端:192.168.5.254,服务器:build.test.com,请求:“GET/jenkins HTTP/1.1”,上游:“http://192.X.X.X:8080/ ", 主机: "build.test.com"

但是在我的本地网络上,当我尝试使用 http://192.X.X.X:8080/ url 访问服务器时,它工作正常。有什么想法吗?

谢谢

最佳答案

做一些研究表明这很可能是 CentOS 中的一个问题,更具体地说,是 SELinux。 SELinux 可能在任何位置引起问题;然而,这可能是一个很好的起点:https://stackoverflow.com/a/24830777/8680186

检查 SELinux 日志,找出如果上述方法没有帮助,它会发出嘶嘶声的原因。

关于Windows 10 上 Jenkins 的 NGINX 反向代理,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/47818667/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com