Ubuntu 22.04 Jenkins SSL Setup: Secure CI/CD with Nginx Reverse Proxy
Ubuntu 22.04 Jenkins SSL Setup (Nginx Reverse Proxy)
In this guide
oaicite:0
server,
**
oaicite:1
You will secure it with SSL using **.
The goal is to protect passwords and sensitive data in the Jenkins interface with HTTPS.
What Will You Learn in This Guide?
- Configure Nginx as reverse proxy for Jenkins
- Disable Jenkins from external access
- Providing secure access via SSL and HTTPS
Technical Summary
Subject: Jenkins SSL and reverse proxy configuration
Problem: Jenkins running without password on port 8080
Solution: Secure tunnel with Nginx + SSL
This structure:
- Disables Jenkins from direct access
- Encrypts all traffic over HTTPS
Prerequisites
Before continuing, you must have the following ready:
-
A server with Ubuntu 22.04 installed
-
Jenkins must be installed and running
-
Nginx must be installed -**
oaicite:2
**SSL certificate must be obtained
-
Domain name (example:
jenkins.sizin-domaininiz.com)
1️⃣ Nginx Reverse Proxy Configuration
Open the Nginx configuration file for your domain:
sudo nano /etc/nginx/sites-available/jenkins.sizin-domaininiz.com
- This file will manage Jenkins requests.
Jenkins Log Settings
access_log /var/log/nginx/jenkins.access.log;
error_log /var/log/nginx/jenkins.error.log;
- These settings log Jenkins traffic separately.
Close the default try_files Line
# try_files $uri $uri/ =404;
- This line can block Jenkins requests.
Reverse Proxy Settings
location / {
include /etc/nginx/proxy_params;
proxy_pass http://localhost:8080;
proxy_read_timeout 90s;
proxy_redirect http://localhost:8080 https://jenkins.sizin-domaininiz.com;
}
- This structure securely forwards HTTPS requests to Jenkins.
Test Configuration
sudo nginx -t
- This command checks that Nginx settings are correct.
2️⃣ Opening Jenkins to Localhost Only
-
Jenkins should not be open to the outside world.
-
Open the configuration file:
sudo nano /etc/default/jenkins
Edit the following line:
JENKINS_ARGS="--webroot=/var/cache/$NAME/war --httpPort=$HTTP_PORT --httpListenAddress=127.0.0.1"
- This setting makes Jenkins accessible only via localhost.
3️⃣ Restarting Services
- First restart Jenkins:
sudo systemctl restart jenkins
- This command activates Jenkins settings.
Then restart Nginx:
sudo systemctl restart nginx
- This process enables reverse proxy and SSL configuration.
4️⃣ Testing over HTTPS
- Navigate to your domain from the browser:
https://jenkins.sizin-domaininiz.com
-
The lock icon should appear in the address bar 🔒
-
HTTP requests are automatically redirected to HTTPS.
Frequently Asked Questions (FAQ)
1. Why is Jenkins restricted to 127.0.0.1 only? To prevent passwordless access by bypassing Nginx.
2. What causes the “Reverse proxy set up is broken” error? Generally, the proxy_redirect line is faulty.
3. I'm getting 502 Bad Gateway, what should I do? Check that the Jenkins service is running.
4. Is SSL mandatory? Definitely yes for production environments.
Result
Congratulations, you have: Encrypted Jenkins on Ubuntu 22.04 with SSL, placed it behind Nginx, established a secure CI/CD environment.
Now Jenkins production is ready to use 🚀
You can safely implement this structure on GenixNode Ubuntu servers in minutes.

