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

设置jenkins代理

时间:2016-10-08 20:03:47      阅读:157      评论:0      收藏:0      [点我收藏+]

标签:

http://stackoverflow.com/documentation/jenkins/919/introduction-to-jenkins 

 

Natively, Jenkins runs on port 8080. We can establish a proxy from port 80 -> 8080 so Jenkins can be accessed via:

http://<url>.com

instead of the default

http://<url>.com:8080

Begin by installing Nginx.

sudo aptitude -y install nginx

Remove the default settings for Nginx

cd /etc/nginx/sites-available

sudo rm default ../sites-enabled/default

Create the new configuration file

sudo touch jenkins

Copy the following code into the newly created jenkins file.

upstream app_server {
  server 127.0.0.1:8080 fail_timeout=0;
}

server {
  listen 80;
  listen [::]:80 default ipv6only=on;
  server_name ;

  location / {
    proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
    proxy_set_header Host $http_host;
    proxy_redirect off;

    if (!-f $request_filename) {
        proxy_pass http://app_server;
        break;
    }
  }
}

Create a symbolic link between sites-available and sites-enabled:

sudo ln -s /etc/nginx/sites-available/jenkins /etc/nginx/sites-enabled/

Restart the Nginx proxy service

sudo service nginx restart

Jenkins will now be accessible from port 80.

设置jenkins代理

标签:

原文地址:http://www.cnblogs.com/itech/p/5939741.html

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