博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
关于nginx反代jenkins报错 反向代理设置有误
阅读量:4311 次
发布时间:2019-06-06

本文共 3432 字,大约阅读时间需要 11 分钟。

915999-20190915003455404-2063144345.png

官方文档地址:

直接解决的配置文件吧.

这是使用子域名,不使用ssl

server {    listen 80;    server_name jenkins.domain.tld;    return 301 https://$host$request_uri;} server {    listen 80;    server_name jenkins.domain.tld;         location / {      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_set_header        X-Forwarded-Proto $scheme;       # Fix the "It appears that your reverse proxy set up is broken" error.      proxy_pass          http://127.0.0.1:8080;      proxy_read_timeout  90;       proxy_redirect      http://127.0.0.1:8080 https://jenkins.domain.tld;        # Required for new HTTP-based CLI      proxy_http_version 1.1;      proxy_request_buffering off;      # workaround for https://issues.jenkins-ci.org/browse/JENKINS-45651      add_header 'X-SSH-Endpoint' 'jenkins.domain.tld:50022' always;    }  }

这里是使用子域名,使用ssl

upstream jenkins {  server 127.0.0.1:8080 fail_timeout=0;} server {  listen 80;  server_name jenkins.domain.tld;  return 301 https://$host$request_uri;} server {  listen 443 ssl;  server_name jenkins.domain.tld;   ssl_certificate /etc/nginx/ssl/server.crt;  ssl_certificate_key /etc/nginx/ssl/server.key;   location / {    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_set_header        X-Forwarded-Proto $scheme;    proxy_redirect http:// https://;    proxy_pass              http://jenkins;    # 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    # workaround for https://issues.jenkins-ci.org/browse/JENKINS-45651    add_header 'X-SSH-Endpoint' 'jenkins.domain.tld:50022' always;  }}

使用域名下路径带ssl https://domain.com/jenkins/

server {   # All your server and TLS/certificate settings are up here somewhere   [...]   # Nginx configuration specific to Jenkins   # Note that regex takes precedence, so use of "^~" ensures earlier evaluation   location ^~ /jenkins/ {       # Convert inbound WAN requests for https://domain.tld/jenkins/ to        # local network requests for http://10.0.0.100:8080/jenkins/       proxy_pass http://10.0.0.100:8080/jenkins/;               # Rewrite HTTPS requests from WAN to HTTP requests on LAN       proxy_redirect http:// https://;       # The following settings from https://wiki.jenkins-ci.org/display/JENKINS/Running+Hudson+behind+Nginx       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 }

记得要修改启动参数

JENKINS_ARGS="--webroot=/var/cache/jenkins/war --httpPort=$HTTP_PORT --ajp13Port=$AJP_PORT --prefix=/jenkins"

转载于:https://www.cnblogs.com/lovesKey/p/11520919.html

你可能感兴趣的文章
新词发现博文收集
查看>>
input text focus去掉默认光影
查看>>
使用JsonP进行跨域请求
查看>>
HDU 5317 RGCDQ (数论素筛)
查看>>
学习JSP(一)
查看>>
node安装-Win+Linux+Mac osx
查看>>
cookie和session笔记
查看>>
Java中使用注释
查看>>
构建你的第一个App
查看>>
Network Mapper 嗅探工具
查看>>
linux下定时执行任务的方法
查看>>
ASP.NET MVC 常用内置验证特性 简介
查看>>
tuple有无list对key的影响
查看>>
java study3
查看>>
优秀的后台管理界面设计案例分享
查看>>
在VIM中使用GDB调试 – 使用vimgdb
查看>>
数据挖掘中哪些算法使用率较高?
查看>>
编程算法 - 推断二叉树是不是平衡树 代码(C)
查看>>
MySpring dataSource从配置文件获取
查看>>
矩阵的转置
查看>>