Configure Port on RHEL

After the installation of Master or JOC through rpm package, the Master is running on port 8080 and the JOC is running on port 8888. 

I wanted to configure each one to run on port 80, by setting the port in the file /etc/sysconfig/jenkins but I get the error: 

SEVERE: Container startup failed 
java.io.IOException: Failed to start Jetty 


Caused by: java.net.SocketException: Permission denied


After a while, I realized the error is caused because the service is not running as root. So my approach was to configure the server (Master or JOC) with iptables redirection as follows:

-bash-4.2$ iptables -t nat -A PREROUTING -p tcp --dport 80 -j DNAT --to :8080

-bash-4.2$ iptables -t nat -A OUTPUT -o lo -p tcp --dport 80 -j REDIRECT --to-ports 8080

It worked for me.

1 comment

Please sign in to leave a comment.