Home > Blockchain >  Jenkins port from 8080 to 80
Jenkins port from 8080 to 80

Time:07-20

I have a Jenkins instance sitting on EC2, I did the usual install (which points to port 8080) and then followed the following steps to change this to port 80:

  1. Go to /etc/default folder --> Open the file "Jenkins". Modify the line HTTP_PORT=8080 as HTTP_PORT=80.
  2. Start Jenkins as root by using the command: sudo /etc/init.d/jenkins start

But I can't navigate to the Jenkins instance on port 80, still only port 8080 (I've stop and started the Jenkins service). I've inbound rules on EC2 set for ports 80, 8080, 22 and 443, but I can't seem to change Jenkins away from port 8080.

Any pointers how to resolve this?

CodePudding user response:

You have to run Jenkins as root if you run it on port 80. Any port <= 1024 requires root in order to bind a server to it.

That being said, if you have the time and patience, you'll have a better experience leaving Jenkins on port 8080 running as a non-root user. You can use nginx as a reverse proxy to serve the jenkins web ui on port 80.

Here's an Ubuntu-specific article on using nginx as a reverse proxy for Jenkins. You didn't say what AMI you're using on your EC2 instance, but it's probably Amazon Linux2 or Ubuntu, so these instructions should work: https://esc.sh/blog/jenkins-nginx-ssl/

  • Related