Configure 2 Tomcat or multiple tomcat on a Linux server

Source: Internet
Author: User

First, when installing 2 tomcat on a server, modify the port number of the Server.xml file in the second Tomcat's Conf directory (original 8080 to 8081, original 8005 to 8006) can be up to two tomcat can be started and the port does not conflict with each other




Second, but this configuration will have two kinds of problems

(1) Start one, and the other dies.

(2) Two start-up operations for the same tomcat


For example, it is not difficult to see that when you start Tomcat for version 9.0.0 (second Tomcat), you are using 8.0.24, the first tomcat environment variable, so when you start and stop the second Tomcat. Actually pointed to the first one.

So if you want each tomcat to run independently at the same time, you need to configure each tomcat to point to its own environment variable


Third, (1) Modify the/etc/profile file, append the following code


#第一个Tomcat
catalina_base=/home/ictuser/apache-tomcat-8.0.24
catalina_home=/home/ictuser/apache-tomcat-8.0.24
Export Catalina_base catalina_home
#第二个Tomcat
Catalina_2_base=/home/ictuser/tomcat_test/apache-tomcat-9.0.0.m11
Catalina_2_home=/home/ictuser/tomcat_test/apache-tomcat-9.0.0.m11
Export catalina_2_base CATALINA_2_HOME
#第一个Tomcat路径
tomcat_home=/home/ictuser/apache-tomcat-8.0.24
Export tomcat_home
#第二个Tomcat路径
TOMCAT_2_HOME=/HOME/ICTUSER/TOMCAT_TEST/APACHE-TOMCAT-9.0.0.M11
Export Tomcat_2_home


Modify the refresh later to make the changes effective. Command:source/etc/profile



(2) Then go to the second Tomcat bin directory.


# OS specific support.   $var _must_ is set to either True or false. Add the following code:


# self:add
Export catalina_base= $CATALINA _2_base
Export catalina_2_home= $CATALINA _2_ HOME
#设置虚拟机参数
java_opts= "-server-xms512m-xmx512m-xss512k-xx:permsize=128m-xx:maxpermsize=256m"


(3) At the same time, the bin directory of Catalina.bat and Startup.bat inside all catalina_home are replaced Catalina_2_home


(4) Starting up 2 Tomcat can be run independently at the same time. More Tomcat configurations and so on


Configure 2 Tomcat or multiple tomcat on a Linux server

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.