Skip to content

Instantly share code, notes, and snippets.

@perfectfoolish
Created November 25, 2013 08:27
Show Gist options
  • Save perfectfoolish/7638155 to your computer and use it in GitHub Desktop.
Save perfectfoolish/7638155 to your computer and use it in GitHub Desktop.
When using SSL, you might want to use something like the below nginx config. Terminate SSL connection at nginx Proxy it internally to Jenkins on port 8080 Replace the Location Header of Jenkins with https instead of http Note that the third point is pretty tricky. We use proxy_redirect http:// https://; that corresponds to Apaches's ProxyPassRev…
upstream jenkins {
server 127.0.0.1:8080 fail_timeout=0;
}
server {
listen 80 default;
server_name 127.0.0.1 *.mydomain.com;
rewrite ^ https://$server_name$request_uri? permanent;
}
server {
listen 443 default ssl;
server_name 127.0.0.1 *.mydomain.com;
ssl_certificate /etc/ssl/certs/my.crt;
ssl_certificate_key /etc/ssl/private/my.key;
ssl_session_timeout 5m;
ssl_protocols SSLv3 TLSv1;
ssl_ciphers HIGH:!ADH:!MD5;
ssl_prefer_server_ciphers on;
# auth_basic "Restricted";
# auth_basic_user_file /home/jenkins/htpasswd;
location / {
proxy_set_header Host $http_host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-Proto https;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_redirect http:// https://;
add_header Pragma "no-cache";
proxy_pass http://jenkins;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment