Home > other >  Setting up Jenkins with Nginx reverse proxy
Setting up Jenkins with Nginx reverse proxy

Time:07-22

I have a Jenkins environment setup, running off a EC2 instance and trying to get port 80 mapped to port 8080.

A suggestion made (and the way most of the configurations I've seen recommended) uses Nginx to do a reverse proxy.

I have installed Nginx on the server, and added to sites-available the following:

server {
    listen 80;
    server_name jenkins.acue.io;

    location / {
        include /etc/nginx/proxy_params;
        proxy_pass          http://localhost:8080;
        proxy_read_timeout  60s;
        # Fix the "It appears that your reverse proxy set up is broken" error.
        # Make sure the domain name is correct
        proxy_redirect      http://localhost:8080 https://jenkins.acue.io;
    }
}

I hit the IP address of the jenkins environment, it shows me the Ngnix welcome screen and Jenkins still loads against port 8080 not port 80.

Do I need to specific the current URL (I've not pointed the jenkins.acue.io sub-domain yet to the EC2 instance where I have specified localhost? I've tried it but no joy).

CodePudding user response:

Few things to note.

You need to add jenkins.acue.io to your Host entries and point it to the instance where you are running NginX. Then use the FQDN to access Jenkins. Also there is a typo in your proxy_redirect where you have added https URL instead of http://jenkins.acue.io fix that as well. Other than that your NginX configurations look fine.

If you keep on getting the NginX welcome page even though you are accessing through the FQDN, that means your configurations are not being picked up by NginX. Try creating a new file like jenkins.conf and add it to /etc/nginx/conf.d. Then do a sudo systemctl restart nginx

  • Related