Image of How to deploy Tomcat web application on port 80

ADVERTISEMENT

Table of Contents

Introduction

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 $/conf and open server.xml.

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

<Connector port="80" protocol="HTTP/1.1"
               connectionTimeout="20000"
               redirectPort="8443" URIEncoding = "utf-8"/>

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.

  1. 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.

Summary

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

Next Steps

If you're interested in learning more about the basics of Java, coding, and software development, check out our Coding Essentials Guidebook for Developers, where we cover the essential languages, concepts, and tools that you'll need to become a professional developer.

Thanks and happy coding! We hope you enjoyed this article. If you have any questions or comments, feel free to reach out to jacob@initialcommit.io.

Final Notes