Skip to content

Instantly share code, notes, and snippets.

@stewsnooze
Last active August 29, 2015 14:11
Show Gist options
  • Save stewsnooze/2b33530cd213fe6b3b9e to your computer and use it in GitHub Desktop.
Save stewsnooze/2b33530cd213fe6b3b9e to your computer and use it in GitHub Desktop.
upstream jenkins {
server 127.0.0.1:8080 fail_timeout=0;
}
server {
listen 80;
server_name myname.com;
rewrite ^ https://$server_name$request_uri? permanent;
}
server {
listen 443 ssl spdy;
ssl_certificate /etc/ssl/certs/my.crt;
ssl_certificate_key /etc/ssl/certs/my.key;
server_name jenkins.myname.com;
#this is the jenkins web root directory (mentioned in the /etc/default/jenkins file)
root /var/cache/jenkins/war;
access_log /var/log/nginx/hudson_access.log;
error_log /var/log/nginx/hudson_error.log;
sendfile on;
}
location @jenkins {
sendfile off;
proxy_redirect http:// https://;
proxy_pass http://jenkins;
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;
proxy_pass_header Authorization;
proxy_max_temp_file_size 0;
#this is the maximum upload size
client_max_body_size 10m;
client_body_buffer_size 128k;
proxy_connect_timeout 90;
proxy_send_timeout 90;
proxy_read_timeout 90;
proxy_buffer_size 4k;
proxy_buffers 4 32k;
proxy_busy_buffers_size 64k;
proxy_temp_file_write_size 64k;
}
location / {
try_files $uri @jenkins;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment