Configure multiple Tomcat methods on the same server

  • 2020-05-27 07:39:59
  • OfStack

If you want to configure multiple Tomcat servers on one server, the main concern is to avoid port conflicts on the Tomcat servers. Just modify the startup port and connection port in CATALINA_HOME\conf\ server.xml!

For your information, let's write down the configuration details below :(in this example, configure 3 Tomcat)

1. Download apache - tomcat - 7.0.63, download address: http: / / tomcat apache. org/download - 70. The cgi download file for apache - tomcat - 7.0.63. zip.

2. Unzip the package to D:/div/.

3. Change the name of the unzip folder to tomcat 7-8080

4. Create two copies of this folder under D:/div/ and rename them tomcat7-8081 and tomcat7-8082, respectively

5. Add environment variables: right-click my computer - > Select properties - > Select advanced - > Select environment variables: add system variables:

CATALINA_HOME_8080, its value is: D:\div\ tomcat7-8080;
CATALINA_HOME_8081, its value is: D:\div\ tomcat7-8081;
CATALINA_HOME_8082, its value is: D:\div\ tomcat7-8082;

6. Modify startup port and shutdown port:

Enter the D:\div\ tomcat7-8081 \conf\ directory, open the server.xml file and modify the following two places:

(1) < Server port="8006" shutdown="SHUTDOWN" >

Modify this port= "8006", the original default is: 8005, so that its closed port does not conflict with another closed port.

(2) < Connector port="8081" maxHttpHeaderSize="8192"
maxThreads="150" minSpareThreads="25" maxSpareThreads="75"
enableLookups="false" redirectPort="8443" acceptCount="100"
connectionTimeout="20000" disableUploadTimeout="true" / >

Change port= "8081" to default to "8080" so that its connection port does not conflict with another one.

(3) < Connector port="8009" protocol="AJP/1.3" redirectPort="8443" / >

Modify this port= "8010", the original default is: 8009, AJP 1.3 Connector definition.

7. Modify startup.bat and catalina.bat file contents:

(1) open the D:\div\ tomcat7-8081 \bin\ startup.bat file and replace all CATALINA_HOME with CATALINA_HOME_8081.

(2) open the D:\div\ tomcat7-8081 \bin\ catalina.bat file and replace all CATALINA_HOME with CATALINA_HOME_8081.

The tomcat7-8082 configuration method is similar to step 1 of tomcat7-8081 configuration.

8. Launch Tomcat, enter three different Tomcat installation directories from the command line, and execute startup.bat to launch three Tomcat. Then type in the browser:

http://localhost:8080

http://localhost:8081

http://localhost:8082


Related articles: