Running Jenkins behind NGINX Proxy

I have a Jenkins server with a private IP address and an NGNIX server with a public IP. I wanted to point the domain for the Jenkins server to the NGINX server and the NGINX server would forward the request the Jenkins server.

I got this working through NGINX proxy pass, here is NGNIX configuration that I have used to get it working.

Assume the domain used for Jenkins server is jenkins.mydomain.com and the IP address of the Jenkins server is 192.168.1.20 running at port 8080.

On the Nginx server we create the file under the sites-available folder, here is the exact path: /etc/nginx/sites-available/jenkins.mydomain.com

Then linked the jenkins.mydomain.com file to sites-enabled

sudo ln -s /etc/nginx/sites-available/jenkins.mydomain.com /etc/nginx/sites-enabled/

Test the updated configuration

sudo nginx -t

Restart the nginx server

sudo systemctl restart nginx

That’s it! Let me know if you have any questions or comments.