Skip to content

Instantly share code, notes, and snippets.

@moziauddin
Created July 9, 2018 06:32
Show Gist options
  • Save moziauddin/e42f893d8d063e8b2a68df3704ebed4f to your computer and use it in GitHub Desktop.
Save moziauddin/e42f893d8d063e8b2a68df3704ebed4f to your computer and use it in GitHub Desktop.
Devops
# Jenkins setup to use reverse proxy using nginx to listen on port 80
sudo apt-get install nginx -y
sudo rm -rf /etc/nginx/sites-enabled/default
# Copy the below configuration to /etc/nginx/sites-available/jenkins
# Create a sym link from /etc/nginx/sites-available/jenkins to /etc/nginx/sites-enabled/jenkins
# Copy the certificate and ket files to the right folder
sudo service jenkins restart
sudo service nginx restart
server {
listen 80;
return 301 https://$host$request_uri;
}
server {
listen 443;
server_name jenkins.domain.com;
ssl_certificate /etc/nginx/cert.crt;
ssl_certificate_key /etc/nginx/cert.key;
ssl on;
ssl_session_cache builtin:1000 shared:SSL:10m;
ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
ssl_ciphers HIGH:!aNULL:!eNULL:!EXPORT:!CAMELLIA:!DES:!MD5:!PSK:!RC4;
ssl_prefer_server_ciphers on;
access_log /var/log/nginx/jenkins.access.log;
location / {
proxy_set_header Host $host;
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://localhost:8080;
proxy_read_timeout 90;
proxy_redirect http://localhost:8080 https://jenkins.domain.com;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment