Skip to content

Instantly share code, notes, and snippets.

@ampedandwired
Created September 25, 2013 06:35
Show Gist options
  • Save ampedandwired/6695861 to your computer and use it in GitHub Desktop.
Save ampedandwired/6695861 to your computer and use it in GitHub Desktop.
Configuring nginx as a Jenkins proxy with SSL
upstream app_server {
server 127.0.0.1:8080 fail_timeout=0;
}
server {
listen 80 default;
rewrite ^ https://$host$request_uri? permanent;
}
server {
listen 443;
listen [::]:443 default ipv6only=on;
ssl on;
ssl_certificate /etc/nginx/ssl/jenkins.pem;
ssl_certificate_key /etc/nginx/ssl/jenkins.key;
server_name $hostname;
location / {
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header Host $http_host;
proxy_redirect http:// https://;
proxy_connect_timeout 150;
proxy_send_timeout 100;
proxy_read_timeout 100;
proxy_buffers 4 32k;
client_max_body_size 8m;
client_body_buffer_size 128k;
if (!-f $request_filename) {
proxy_pass http://app_server;
break;
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment