How to deploy Tomcat web application on port 80

In this tutorial, we describe how to deploy a Tomcat web application on port 80.

As known, 80 is the default port of the web, every time you access a website through your browser, you’re actually calling the port 80.

Below, we define 2 ways for deploying a Tomcat web application on port 80:

1. Start Tomcat on port 80

You can simply configure Tomcat to start on port 80 through modifying the “Connector” tag inside server.xml.

Go to ${TOMCAT_HOME}/conf and open server.xml.

Search for “Connector” tag and set the port attribute to “80” as follows:

However, this solution has a limitation where Tomcat would only start with a root and privileged user. It would work well in the development environments, but it’s a headache in the production environments especially on Linux systems.

2. Reverse Proxy

The most common and traditional way of deploying a Tomcat web application on port 80 is to install an Apache web server on top of Tomcat and redirect any Apache request to the configured Tomcat instance.

This way, you can run Tomcat at any non-privileged port and keep exposing it on port 80 through an Apache web server.

For more details on how to reverse proxy, please refer to this tutorial: Load balancing tomcat with Apache.

 

Hussein Terek

Founder of programmergate.com, I have a passion in software engineering and everything related to java environment.

You may also like...

Leave a Reply

avatar