Running Multiple Apache Tomcat on same Machine

本文介绍如何在同一台机器上配置多个Apache Tomcat实例的方法,包括更改端口号以实现负载均衡或隔离Web应用等目的。文章详细解释了Tomcat使用的各种端口及其在server.xml文件中的配置方式。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

Sometimes we want to run multiple instance of Apache TOMCAT on same machine may be for load balancing, separating web application etc. This article describes on how we can run multiple instance of Apache TOMCAT on same machine.

Running multiple Apache TOMCAT instance does not require any change in the server code, we just need to change the port no assigned to the Apache TOMCAT.

NOTE:

  • In this article i will be referring to Apache TOMCAT 6 configuration. But the same is applicable for 5.5 also.
  • Also to change the port configuration you need to edit server.xml, this file resides insideapache-tomcat-/conf/ folder.


Ports Used in Apache TOMCAT:

  • Shutdown Port
  • Tomcat Connector Port
  • AJP Connector Port
  • Redirect Port


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

<server port="8005" shutdown="SHUTDOWN">
</server>


Connector Port:
This port is used to connect to Apache TOMCAT server. By default 8080 is set. We can identify this Port inside server.xml by checking the following tag.

     <connector port="8080" protocol="HTTP/1.1" connectionTimeout="20000" redirectPort="8443" />

AJP Connector Port:
This port is used AJP port, AJP is used to redirect the request to Apache Web Server from Apache TOMCAT Server. We can identify this Port inside server.xml by checking the following tag.

      <connector port="8009" protocol="AJP/1.3" redirectPort="8443" />


Redirect Port:
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.

      <connector port="8009" protocol="AJP/1.3" redirectPort="8443" />
 
     <connector port="8100" protocol="HTTP/1.1" connectionTimeout="20000" redirectPort="8443" />

You need to only change the port no only, rest is taken care by the tomcat server. Ensure that redirectPort should be same for AJP and HTTP protocol.

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值