Natively, Jenkins runs on port 8080. We can establish a proxy from port 80 -> 8080 so Jenkins can be accessed via:
http://<url>.com
instead of the default
http://<url>.com:8080
Begin by installing Nginx.
sudo aptitude -y install nginx
Remove the default settings for Nginx
cd /etc/nginx/sites-available
sudo rm default ../sites-enabled/default
Create the new configuration file
sudo touch jenkins
Copy the following code into the newly created jenkins
file.
upstream app_server {
server 127.0.0.1:8080 fail_timeout=0;
}
server {
listen 80;
listen [::]:80 default ipv6only=on;
server_name ;
location / {
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header Host $http_host;
proxy_redirect off;
if (!-f $request_filename) {
proxy_pass http://app_server;
break;
}
}
}
Create a symbolic link between sites-available and sites-enabled:
sudo ln -s /etc/nginx/sites-available/jenkins /etc/nginx/sites-enabled/
Restart the Nginx proxy service
sudo service nginx restart
Jenkins will now be accessible from port 80.