Nginx配置Jenkins域名访问

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;
 
 
 
 
    }
  }
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;
    rewrite ^(.*)$ https://$host$1 permanent;
}
 
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;
  }
}

本文链接:

https://pugqq.com/archives/nginx-jenkins-domain.html
Nginx配置Jenkins域名访问 - I/O
快来做第一个评论的人吧~

# 最近更新

Nginx的proxy_pass指令完全拆解2021-03-21

Nginx配置Jenkins域名访问2021-01-03

设计模式 - 浅谈备忘录模式2020-12-02

设计模式 - 浅谈中介者模式2020-11-23

设计模式 - 浅谈迭代器模式2020-11-02

MySQL5.7 字符集设置2020-10-26

设计模式 - 浅谈状态模式2020-10-23

设计模式 - 浅谈访问者模式2020-10-13

设计模式 - 浅谈观察者模式2020-10-12

设计模式 - 浅谈命令模式2020-09-21