設置jenkins代理

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

 

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

http://<url>.com

instead of the defaulturl

http://<url>.com:8080

Begin by installing Nginx.spa

sudo aptitude -y install nginxrest

Remove the default settings for Nginxcode

cd /etc/nginx/sites-availableserver

sudo rm default ../sites-enabled/defaultip

Create the new configuration filejenkins

sudo touch jenkinsit

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.

相關文章
相關標籤/搜索