I installed Jenkins on a Ubuntu 18.04 ec2 instance by following its official guide.
I want to change Jenkins from port 8080 (default) to port 80.
According to its official document:
If your /etc/init.d/jenkins file fails to start Jenkins, edit the /etc/default/jenkins to replace the line ----HTTP_PORT=8080---- with ----HTTP_PORT=8081---- Here, "8081" was chosen but you can put another port available.
I managed to changed it to port 8081 but when I used port 80, it simply doesn't work:
curl -i localhost:80
returns connection refused
sudo systemctl status jenkins
gives
jenkins.service - LSB: Start Jenkins at boot time
Loaded: loaded (/etc/init.d/jenkins; generated)
Active: active (exited) since Thu 2019-02-21 08:14:55 UTC; 4min 12s ago
Docs: man:systemd-sysv-generator(8)
Process: 6143 ExecStop=/etc/init.d/jenkins stop (code=exited, status=0/SUCCESS)
Process: 6212 ExecStart=/etc/init.d/jenkins start (code=exited, status=0/SUCCESS)
Feb 21 08:14:53 ip-172-31-11-10 systemd[1]: Starting LSB: Start Jenkins at boot time...
Feb 21 08:14:53 ip-172-31-11-10 jenkins[6212]: Correct java version found
Feb 21 08:14:53 ip-172-31-11-10 jenkins[6212]: * Starting Jenkins Automation Server jenkins
Feb 21 08:14:53 ip-172-31-11-10 su[6257]: Successful su for jenkins by root
Feb 21 08:14:53 ip-172-31-11-10 su[6257]: + ??? root:jenkins
Feb 21 08:14:53 ip-172-31-11-10 su[6257]: pam_unix(su:session): session opened for user jenkins by (uid=0)
Feb 21 08:14:54 ip-172-31-11-10 su[6257]: pam_unix(su:session): session closed for user jenkins
Feb 21 08:14:55 ip-172-31-11-10 jenkins[6212]: ...done.
Feb 21 08:14:55 ip-172-31-11-10 systemd[1]: Started LSB: Start Jenkins at boot time.
I am sure nothing runs on port 80.
What am I doing wrong?
sudo systemctl status jenkins
and the status reports Jenkins' state isactive (exited)
with a green dot. I just don't know how to troubleshoot these incidents in the future.Caused by: java.net.SocketException: Permission denied
. It doesn't specifically says sth like unable to bind to ... but I guess it's the same, though it's a bit harder for me to guess if the error log is like this.