Run Tomcat on port 80 with port redirection
Tomcat, by default runs on port 8080. You may want to make it run on port 80. Changing the port to 80 in the tomcat configurations wont work as port 80 is a privileged port and needs user with admin/root privileges. Making tomcat run as a root user is a big no no as well, as it could compromise your tomcat installation. The best solution to make tomcat work on port 80 is to do a port redirect using iptables.
Port redirect: 80 => 8080
Here is a two liner solution to enable port redirection from port 80 to 8080 on a linux server
iptables -t nat -A PREROUTING -p tcp --dport 80 -j REDIRECT --to-ports 8080 iptables -t nat -A OUTPUT -p tcp --dport 80 -j REDIRECT --to-ports 8080
Tagged with: 80 • 8080 • admin • best solution • default • dport • firewall • iptables • linux • linux server • maverick meerkat • nat • OpenSuse • OUTPUT • port 8080 • port redirection • ports • PREROUTING • privileged port • redirect • root • root privileges • root user • run • src • tcp • Tomcat • tomcat installation • ubuntu • ubuntu 10.10
Resources










