How To Run/Access Jenkins on Port 80 in Linux

When you install Jenkins, by default the Jenkins service runs on port 8080. Also, there is no direct option to run the Jenkins service on port 80. In this tutorial, we have explained the steps to setup Jenkins access on port 80.

Running Jenkins on Port 80

You can achieve this using the following methods.

  1. An IP table forwarding rule.
  2. Using a reverse proxy like Nginx.
  3. Running Jenkins behind a load balancer.

We will explain all three methods. You can choose one which is suitable for your environment.

Method 1: Running Jenkins on 80 Using IP table Forwarding Rule

This is the easiest way to access Jenkins on port 80. All you have to do is run the following IP wording rule.

Now, you should save these rules so that it will persist even after an IPtable or a system restart.

For Redhat based systems, run the following.

For Debian based systems, execute the following command.

Now if you access Jenkins on port 80, IP table will automatically forward the requests to 8080.

Method 2: Running Jenkins Behind Nginx Reverse Proxy

Nginx is very lightweight and it can act as a best reverse proxy for Jenkins. Follow the steps given below to run Jenkins behind a Nginx reverse proxy.

Step1: Install Nginx

READ  Skillsets To Work In DevOps Environment - A Comprehensive Guide

Step 2: Open the Nginx configuration file.

Step 3: Find the following snippet in the nginx.conf file.

Step 4: Add the following lines between the curly braces.

Step 5: Execute the SELinux command for the Nginx reverse proxy.

Step 6: Restart the Nginx server.

Now if you will be able to access Jenkins on port 80.

Method 3: Jenkins behind a load balancer

Adding a load balancer will add extra cost to the Jenkins setup. If you are on a cloud, you can opt for a cloud-specific load balancer which will send all its port 80 traffic to backend Jenkins 8080 port.

 

Free DevOps Resources

Get DevOps news, tutorials and resources in your inbox. A perfect way If you want to get started with devops. Like you, we dont like spam.