码迷,mamicode.com
首页 > 其他好文 > 详细

Nginx 配置 Jenkins 反向代理

时间:2019-03-03 20:26:34      阅读:521      评论:0      收藏:0      [点我收藏+]

标签:return   tps   log   etc   gzip   访问   www   html   ali   

安装 Nginx

参考之前的一篇文章 Nginx 安装配置

安装 Jenkins

参考之前的一篇文章 Linux 搭建 Jenkins

Nginx 配置 Jenkins 的反向代理

# /etc/nginx/conf.d
upstream jenkins {
        server 127.0.0.1:8080;
}

server {
    listen 80;
    server_name jenkins-pro.michael.com;
    charset utf-8;
    client_body_buffer_size 10M;
    proxy_redirect     off;
    proxy_set_header   Host             $host:$server_port;
    proxy_set_header   X-Real-IP        $remote_addr;
    proxy_set_header X-Forwarded-Host $host:$server_port;
    proxy_set_header X-Forwarded-Server $host;
    proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
    proxy_set_header X-Forwarded-Proto $scheme;
    proxy_next_upstream error timeout invalid_header http_502 http_503 http_504;
    proxy_ignore_client_abort on;
    proxy_read_timeout  180;
    proxy_buffering on;
    proxy_buffer_size 8k;

    proxy_buffers 8 8M;

    gzip                on;
    gzip_min_length     1000;
    gzip_types          text/plain text/css application/json text/xml application/xml application/xml+rss text/javascript;

    location / {
       proxy_pass http://jenkins;
       proxy_redirect     default;
       proxy_set_header   Host             $host:$server_port;
       proxy_set_header   X-Real-IP        $remote_addr;
       proxy_set_header X-Forwarded-Host $host:$server_port;
       proxy_set_header X-Forwarded-Server $host;
       proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
       proxy_set_header X-Forwarded-Proto $scheme;
    }
}

执行 systemctl reload nginx 你就可以用域名访问 jenkins 了

参考

Nginx 配置 Jenkins 反向代理

标签:return   tps   log   etc   gzip   访问   www   html   ali   

原文地址:https://www.cnblogs.com/michael-xiang/p/10467273.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!