I have installed nginx along with jenkins on ubuntu 21 machine.
Configured nginx to redirect 80 traffic to 8080 using the steps in this link
Now, able to redirect the traffic from 80 to 8080.
So, to disable direct access to jenkins from 8080 externally.
Changed the arguments in /etc/default/jenkins to add line --httpListenAddress=127.0.0.1
Now, the jenkins arguments line is as below.
JENKINS_ARGS="--webroot=/var/cache/$NAME/war --httpPort=$HTTP_PORT --httpListenAddress=127.0.0.1"
Then, restarted the machine also after that but still able to access directly with 8080 port.
Please suggest how to achieve this.
azureuser@jenkins:~$ ss -lnpt
State Recv-Q Send-Q Local Address:Port Peer Address:Port Process
LISTEN 0 511 0.0.0.0:80 0.0.0.0:*
LISTEN 0 4096 127.0.0.53%lo:53 0.0.0.0:*
LISTEN 0 128 0.0.0.0:22 0.0.0.0:*
LISTEN 0 4096 *:3000 *:*
LISTEN 0 50 *:8080 *:*
LISTEN 0 128 [::]:22 [::]:*
azureuser@jenkins:~$ ps auxw | grep jenkins
jenkins 6761 0.1 11.8 3036280 416756 ? Ssl Mar29 8:08 /usr/bin/java -Djava.awt.headless=true -jar /usr/share/java/jenkins.war --webroot=/var/cache/jenkins/war --httpPort=8080
azureus+ 86025 0.0 0.0 8548 2356 pts/0 S+ 19:09 0:00 grep --color=auto jenkins