Issue:
Changing Port 8080 to 80 using Tomcat


Solution:

There are several ways to achieve this:

  1. Open the server.xml of your Tomcat installation.

    Find the line:

    connector port="8080"

    and change it to 

    connector port="80"

    Make sure you change the HTTP Connector and not the AJP Connector. Furthermore make sure, that the user that starts the Tomcat server has the right to bind to a port below 1024. This is important on linux systems. 
  2. When running Apache aside of Tomcat, you can add a virtualhost to the httpd.conf and add a AJP Connector module to it. (E.g. mod_proxy or mod_jk for Apache or isapi_redirect for IIS)
  3. Use iptables for port forwarding, e.g.:
    iptables -t nat -A OUTPUT -d localhost -p tcp --dport 80 -j REDIRECT --to-ports 8080
    iptables -t nat -A OUTPUT -d your hostname -p tcp --dport 80 -j REDIRECT --to-ports 8080
    iptables -t nat -A PREROUTING -d your hostname -p tcp --dport 80 -j REDIRECT --to-ports 8080
  4. Use JSVC on Linux systems. Click here for more information.


Return to Overview