Take three Tomcat as an example:
Configure Environment Variables First:
Edit/etc/profile File
Add three Tomcat environment variables: value is the Tomcat directory
First Tomcat
catalina_base=/usr/local/tomcat/tomcat1/apache-tomcat-7.0.52catalina_home=/usr/local/tomcat/tomcat1/ Apache-tomcat-7.0.52tomcat_home=/usr/local/tomcat/tomcat1/apache-tomcat-7.0.52export CATALINA_BASE CATALINA_HOME tomcat_home//a second tomcatcatalina_2_base=/usr/local/tomcat/tomcat2/apache-tomcat-7.0.52catalina_2_home=/usr/local /tomcat/tomcat2/apache-tomcat-7.0.52tomcat_2_home=/usr/local/tomcat/tomcat2/apache-tomcat-7.0.52export CATALINA _2_base Catalina_2_home tomcat_2_home//a third tomcatcatalina_3_base=/usr/local/tomcat/tomcat3/ apache-tomcat-7.0.52catalina_3_home=/usr/local/tomcat/tomcat3/apache-tomcat-7.0.52tomcat_3_home=/usr/local/ Tomcat/tomcat3/apache-tomcat-7.0.52export catalina_3_base catalina_3_home Tomcat_3_home
After saving, exit, and then reload the file again, using the command:
Source/etc/profile
Modify Tomcat's Server.xml and catalina.sh files:
The first Tomcat does not have to change, by default even with the following configuration inside the environment variable
The first of the TOMCATCATALINA_BASE=/USR/LOCAL/TOMCAT/TOMCAT1/APACHE-TOMCAT-7.0.52CATALINA_HOME=/USR/LOCAL/TOMCAT/TOMCAT1 /apache-tomcat-7.0.52tomcat_home=/usr/local/tomcat/tomcat1/apache-tomcat-7.0.52export CATALINA_BASE CATALINA_ HOME Tomcat_home
The second one is changed to the second environment variable configuration:
Server.xml file:
The shutdown port is changed to 8007, with two different <server port= "8007" shutdown= "shutdown" > <!--Security Listener. Documentation at/docs/config/listeners.html <listener classname= " Org.apache.catalina.security.SecurityListener "/>//boot port changed to 8082, with two different <connector port=" 8082 "uriencoding=" UTF-8 "protocol=" http/1.1 " connectiontimeout=" 20000 "redirectport=" 8443 "/>// this AJP port is changed to 8011, unlike the other two <!--Define an AJP 1.3 Connector on port 8009--><connector port= "8011" protocol= "ajp/1.3" redirectport= "8443"/& Gt
To modify the catalina.sh file in the bin directory, use the second set of Tomcat environment variables:
In the # OS specific support. $var _must_ is set to either True or false. Add export catalina_base= $CATALINA _3_baseexport catalina_home= $CATALINA _3_ HOME
Similarly: the third Tomcat:
Server.xml file:
The shutdown port is changed to 8007, with two different <server port= "8007" shutdown= "shutdown" > <!--Security Listener. Documentation at/docs/config/listeners.html <listener classname= " Org.apache.catalina.security.SecurityListener "/>//boot port changed to 8082, with two different <connector port=" 8082 "uriencoding=" UTF-8 "protocol=" http/1.1 " connectiontimeout=" 20000 "redirectport=" 8443 "/>// this AJP port is changed to 8011, unlike the other two <!--Define an AJP 1.3 Connector on port 8009--><connector port= "8011" protocol= "ajp/1.3" redirectport= "8443"/& Gt
To modify the catalina.sh file in the bin directory, use the third set of Tomcat environment variables:
In the # OS specific support. $var _must_ is set to either True or false. Add export catalina_base= $CATALINA _3_baseexport catalina_home= $CATALINA _3_ HOME
Then start each tomcat.
You may not be able to perform startup or shutdown at startup. The SH command, or the TAB key, is not recognized automatically. SH file, which is the reason why no. SH permission
Use the following command to get executable permissions:
Execute under the Tomact installation directory where all. sh files under the bin directory under the directory have executable permissions chmod +x./bin/*.sh
Server builds multiple Tomcat servers