A lot of time we want to run multiple instances of Apache Tomcat server on a single machine. Generally this is done for creating a separate load balancer server for an application or install a different application independently.
This can be achieved easy by some configuration in Tomcat Server. We need to install a second instance of Tomcat and change few port in configuration files.
Open server.xml from /conf directory of your Tomcat installation folder. Change following ports in server.xml file.
This is the port where Apache Tomcat listen for the HTTP requests. By default this port is set to 8080. We can identify this Port inside server.xml by checking the following tag. Change the port to different value (for example 8081) and the second instance will listen the HTTP request on that port.
This port is used when we try to shutdown the Apache Tomcat Server. We can identify this Port inside server.xml by checking the following tag.
AJP (Apache JServ Protocol) Connector Port
The Apache JServ Protocol (AJP) is a binary protocol that can conduct inbound requests from a web server through to an application server that sits behind the web server. We can identify this Port inside server.xml by checking the following tag.
Any redirection happening inside Apache Tomcat will happen through this port. In Apache TOMCAT there are two instance where redirectPort is mentioned. First one is for the Apache TOMCAT server and other one is for the AJP port. We can identify this Port inside server.xml by checking the following tag. Ensure that redirectPort should be same for AJP and HTTP protocol.