【问题标题】:NGINX reverse proxy for Jenkins on a Windows 10Windows 10 上 Jenkins 的 NGINX 反向代理
【发布时间】: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


    【解决方案1】:

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

    如果上述方法没有帮助,请检查 SELinux 日志以了解为什么它会出现问题。

    【讨论】:

    • 这行得通!感谢 cstarner 的帮助,不会关注 SELinux 方面。
    • 很高兴听到这个消息!你介意接受我的回答吗?
    猜你喜欢
    • 2020-07-11
    • 1970-01-01
    • 2018-02-22
    • 2017-07-17
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多