Skip to content

Instantly share code, notes, and snippets.

@olegbuevich
Created June 6, 2018 09:31
Show Gist options
  • Save olegbuevich/c00a8a3b3efc245c3732ba7334d76fa8 to your computer and use it in GitHub Desktop.
Save olegbuevich/c00a8a3b3efc245c3732ba7334d76fa8 to your computer and use it in GitHub Desktop.
jenkins + nginx proxy (JENKINS_ARGS=--prefix=/jenkins)
server {
listen 80 default_server;
server_name dev.example.com;
return 301 https://$host$request_uri;
}
server {
listen 443 ssl default_server;
server_name dev.example.com;
ssl_certificate /etc/letsencrypt/live/dev.example.com/fullchain.pem;
ssl_certificate_key /etc/letsencrypt/live/dev.example.com/privkey.pem;
add_header Strict-Transport-Security max-age=15768000;
if ($host != "dev.example.com") {
return 403;
}
location / {
return 403;
}
location ^~ /jenkins {
proxy_pass http://localhost:8080;
sendfile off;
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-Host $host;
proxy_set_header X-Forwarded-Proto $scheme;
client_max_body_size 10m;
proxy_connect_timeout 90;
proxy_send_timeout 90;
proxy_read_timeout 90;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment