NGINX/JENKINS:您的反向代理设置似乎已损坏 [英] NGINX/JENKINS: It appears that your reverse proxy set up is broken

查看:1631
本文介绍了NGINX/JENKINS:您的反向代理设置似乎已损坏的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

关于如何使NGINX与Jenkins合作,我至少尝试了六个示例.我最近的NGINX配置基于以下示例:

I've tried at least a half a donzen examples on how to get NGINX working with Jenkins. My most recent NGINX configuration is based on the following example:

https://wiki.jenkins.io/display/JENKINS /Running + Jenkins + behind + Nginx

无论如何我都不会尝试,詹金斯一直说It appears that your reverse proxy set up is broken.,我希望有人能找出问题所在,因为我花了数小时试图解决这个问题,但仍无济于事.

No mater what I try, Jenkins keeps saying It appears that your reverse proxy set up is broken. I'm hoping someone can spot what is wrong as I have spent hours trying to solve this to no avail.

谢谢!

upstream cicd {
        keepalive 32;
        server 127.0.0.1:8080;
}

server {
        listen 443 ssl;
        listen [::]:443 ssl ipv6only=on;

        server_name cicd.domain.com;

        root /var/run/jenkins/war/;

        access_log /var/log/nginx/jenkins/access.log;
        error_log /var/log/nginx/jenkins/error.log;

        ssl_certificate /etc/letsencrypt/live/cicd.domain.com/fullchain.pem;
        ssl_certificate_key /etc/letsencrypt/live/cicd.domain.com/privkey.pem;
        include /etc/letsencrypt/options-ssl-nginx.conf;
        ssl_dhparam /etc/letsencrypt/ssl-dhparams.pem;

        #static files
        location ~ "^/static/[0-9a-fA-F]{8}\/(.*)$" {
                rewrite "^/static/[0-9a-fA-F]{8}\/(.*)" /$1 last;
        }

        #user content
        location /userContent {
                root /var/lib/jenkins/;

                if (!-f $request_filename){
                        rewrite (.*) /$1 last;
                        break;
                }
                sendfile on;
        }

        #cicd
        location @cicd {
                sendfile off;
                proxy_pass              http://cicd;
                proxy_redirect          http://localhost:8080 https://cicd.domain.com;
                proxy_http_version      1.1;

                proxy_set_header        Host                    $host;
                proxy_set_header        X-Real-IP               $remote_addr;
                proxy_set_header        X-Forwarded-Host        $host;
                proxy_set_header        X-Forwarded-For         $proxy_add_x_forwarded_for;
                proxy_set_header        X-Forwarded-Proto       $scheme;
                proxy_max_temp_file_size 0;

                client_max_body_size            10m;
                client_body_buffer_size         128k;

                proxy_connect_timeout           90;
                proxy_send_timeout              90;
                proxy_read_timeout              90;
                proxy_buffering                 off;
                proxy_request_buffering         off;
                proxy_set_header Connection     "";
        }

        #optional
        location / {
                if ($http_user_agent ~* '(iPhone|iPod)') {
                        rewrite ^/$ /view/iphone/ redirect;
                }

                try_files $uri @cicd;
        }

}

推荐答案

这不是NGINX问题.

This is not a NGINX problem.

在Jenkins内部,您需要配置Jenkins URL.如果未正确设置,则会得到您观察到的错误.
选中Jenkins-> Manage Jenkins-> Configure System => Jenkins URL.

Inside Jenkins you need to configure the Jenkins URL. If it is not set correctly you will get the error you observed.
Check Jenkins -> Manage Jenkins -> Configure System => Jenkins URL.

这篇关于NGINX/JENKINS:您的反向代理设置似乎已损坏的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆