How to open multiple Tomcats at the same time on Windows and solve various problems encountered

How to start multiple Tomcats on the cloud server

1. Copy Tomcat again, and configure an environment variable such as CATALINA_HOME2. The environment variable value is the directory of the second Tomcat you copied. After configuring, you also need to configure PATH. I won’t go into details about this.

2. Modify shutdowm.bat, startup.bat, catalina.bat in apache-tomcat-8.5.39-2,
open these files with Notepad, and replace all CATALINA_HOME in the file with CATALINA_HOME2 (which is the second Tomcat environment you configured variable name)

3. Modify server.xml in apache-tomcat-8.5.39-solr

<!--这里的port绝对不能与第一个Tomcat中server.xml中配置相同  不然会启动失败!-->
<Server port="8006" shutdown="SHUTDOWN">
 
<!--这里的port我修改成8081,当然第一个Tomcat默认的是8080 这就是访问端口-->
<Connector port="8081" protocol="HTTP/1.1"
               connectionTimeout="20000"
               redirectPort="8443" />

You will encounter a problem here : after configuring the access port, you must open it on your cloud server. Don’t forget it. This is why I have been working on it for a long time.

4. Find startup.bat in the bin directory and double-click to start two Tomcats, so that both Tomcats can be started at the same time.

If it still doesn’t work, you can run shuntdown.bat and then start it again.

     //这里别忘记改域名
      <Host name="填写你的域名"  appBase="webapps"
            unpackWARs="true" autoDeploy="true">

Configuration example

www.Domain name 1.com (port 8080 can be ignored)

www.Domain name 2.com:8081 (this 8081 cannot be ignored, pay attention to the open port of the cloud server)

Started successfully:

 

Guess you like

Origin blog.csdn.net/m0_64547949/article/details/127765812