Lots of people have posted configurations of Nginx to allow effective proxying of Jenkins when they are both on the same server, but for some reason, it seems that having them on different servers doesn’t seem as commonly discussed. I am using Nginx in my SOHO network to front a few virtual servers, and provide them all via the few IPs I have on my Comcast Business Class connection. That means having a proxy that can serve up the various systems supporting various domains.
We’ve covered how to build a Jenkins server, so for the sake of documenting this additional capability, here’s my configuration:
server { listen 80; server_name jenkins.domain.com; access_log /var/log/nginx/jenkins_access.log main buffer=32k; error_log /var/log/nginx/jenkins_error.log; rewrite /jenkins/(.*) /$1 last; location / { proxy_pass http://192.168.1.115:8080/jenkins/; proxy_redirect off; proxy_set_header Host $http_host; proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; # max upload size client_max_body_size 20m; 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; } }