Nginx

Setup Nginx Reverse Proxy For Jenkins

In this article I will guide you how you can setup Nginx as reverse proxy for Jenkins. In order to facilitate visitors’ access to Jenkins, you can setup an Nginx reverse proxy for Jenkins, so visitors will no longer need to key in the port number 8080 when accessing your Jenkins application.

To Install Jenkins please follow my previous article refer to :

Install Nginx

# yum install nginx -y

After installing Nginx, modify its configuration file:

# vim /etc/nginx/nginx.conf 

Find the below lines:

location / {
}

Setup Nginx As a Reverse Proxy for Jenkins

Insert the below six lines into the {} segment:

proxy_pass http://127.0.0.1:8080;
proxy_redirect off;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;

Final result look like below:

location / {
    proxy_pass http://127.0.0.1:8080;
    proxy_redirect off;
    proxy_set_header Host $host;
    proxy_set_header X-Real-IP $remote_addr;
    proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
    proxy_set_header X-Forwarded-Proto $scheme;
}

Save and quit.

:wq!

Now restart the Nginx service.

# service nginx restart

Allow traffic on port 80 on your firewall.

Finally, visit the following address from your web browser to confirm your installation.

http://your_server_IP_or_domain_name/

In my case my server IP address is 192.168.0.109.

Jenkins-home-page

Thanks:)

Thank you! for visiting LookLinux.

If you find this tutorial helpful please share with your friends to keep it alive. For more helpful topic browse my website www.looklinux.com. To become an author at LookLinux Submit Article. Stay connected to Facebook.

About the author

mm

Santosh Prasad

Hi! I'm Santosh and I'm here to post some cool article for you. If you have any query and suggestion please comment in comment section.

Leave a Comment