How to configure multi-channel tomcat in Linux

1. Deploy two Tomcats under /usr/local, rename the tomcat folders to: tomcat6-1, tomcat6-2
2. Modify the linux profile file, the file path /etc and add the following content to the profile:
JAVA_HOME=/ home/user/java/jdk1.7.0_79
CLASSPATH=.:$JAVA_HOME/lib/tools.jar:$JAVA_HOME/lib:$JAVA_HOME/bin
export JAVA_HOME CLASSPATH

# tomcat1
CATALINA_BASE=/home/apache-tomcat-7.0.82/
CATALINA_HOME=/home/apache-tomcat-7.0.82/
export CATALINA_BASE CATALINA_HOME
 
#
tomcat2 CATALINA_2_BASE=/home/ditu/
CATALINA_2_HOME=/home/ditu/
export CATALINA_2_BASE CATALINA_2_HOME


TOMCAT_HOME=/home/apache-tomcat-7.0.82/
export TOMCAT_HOME

TOMCAT_2_HOME=/home/ditu/
export TOMCAT_2_HOME


Run the command: source /etc/profile to make the configuration environment effective

3. Modify the configuration file of tomcat The configuration file

      of tomcat6-1 remains unchanged;

      the configuration file of tomcat6-2 is modified as follows:

     Modify the files under tomcat6-2/bin: startup.sh and shutdown.sh (the added content is the same), Add the following to the file:
export JAVA_HOME=/home/user/java/jdk1.7.0_79
export PATH=$PATH:$JAVA_HOME/bin
export CLASSPATH=.:$JAVA_HOME/lib/tools.jar:$JAVA_HOME/lib: $JAVA_HOME/bin

export CATALINA_HOME=$CATALINA_2_HOME  
export CATALINA_BASE=$CATALINA_2_BASE  


Modify the service.xml file under tomcat6-2/conf as follows:

<Server port="8005" shutdown="SHUTDOWN">     
#8005 Change to 8006 (other unused ports are also fine)


<Connector port="8080" protocol="HTTP/1.1"        
               connectionTimeout="20000"
               redirectPort="8443" />
     # 8080 is changed to 8081 (other unused ports are also available)           
               

 <Connector port="8009" protocol="AJP/1.3" redirectPort="8443" />    
 #8009 is changed to 8010 (other unused ports are also available)
 
 
 4. Restart Start Linux and
 start two tomcats:
sh /usr/local/tomcat6-1/bin/startup.sh
sh /usr/local/tomcat6-1/bin/startup.sh


Reference URL:

https://blog.csdn.net/ a19860903/article/details/49890013
 

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=325139792&siteId=291194637