Skip to content

Instantly share code, notes, and snippets.

@jmdobry
Created March 12, 2014 15:05
Show Gist options
  • Save jmdobry/9508801 to your computer and use it in GitHub Desktop.
Save jmdobry/9508801 to your computer and use it in GitHub Desktop.
Jenkins reverse proxy and password

Install nginx: sudo apt-get install nginx

Create a new virtual host (server block): sudo cp /etc/nginx/sites-available/default /etc/nginx/sites-available/jenkins

Edit this file: sudo vi /etc/nginx/sites-available/jenkins

to say:

server {
  listen 80;
  server_name domain.com;
  
  location /jenkins/ {
    auth_basic "Restricted";
    auth_basic_user_file /etc/nginx/.jenkins.pass;
    proxy_pass http://127.0.0.1:8080/;
    proxy_redirect off;
    proxy_set_header Authorization "";
  }
}

where domain.com is the host name (or IP address) of the server running the RethinkDB Admin UI.

Create username and password (make sure you have apache2-utils installed sudo apt-get install apache2-utils): cd /etc/nginx/ htpasswd -c .jenkins.pass <username> where <username> is the username you want. The command will ask you to enter the password for the username you chose.

start/restart nginx sudo service nginx start or sudo service nginx restart

Verify it works: Navigate to http://domain.com/jenkins where domain.com is the host name (or IP address) of the server running the Jenkins instance.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment