linux multiple tomcat configurations

The tomcatq startup principle is described as follows:

1. When tomcat starts, it will search for the root directory of tomcat, and it will search through the two variables CATALINA_BASE and CATALINA_HOME, so the root directory of different tomcat on different servers and the values ​​of the above two variables are different. , so we'll set it up.

2. The tomcat server needs to be configured with three ports to start. These three ports are configured and enabled by default during installation, so when you want to run multiple tomcat services, you need to modify these three ports, which cannot be the same to prevent port conflicts.

【webapp@WEBAPP95~】unzip apache-tomcat-7.0.82.zip -d apache-tomcat-7.0.82

【root@WEBAPP95 webapp】# vim /etc/profile

#########jdk###########

export JAVA_HOME=/webapps/IBM/Websphere/ApppServer/java_1.7_64

export PATH=$JAVA_HOME/bin:$PATH

export CLASSPATH=.:$JAVA_HOME/lib/dt.jar:$JAVA_HOME/lib/tools.jar

#########tomcat1#######

export CATALINA_HOME=/home/webapp/tomcat1/apache-tomcat-7.0.82

export CATALINA_BASE=/home/webapp/tomcat1/apache-tomcat-7.0.82

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

#########tomcat2#######

export CATALINA_HOME_2=/home/webapp/tomcat2/apache-tomcat-7.0.82

export CATALINA_BASE_2=/home/webapp/tomcat2/apache-tomcat-7.0.82

export TOMCAT_HOME_2=/home/webapp/tomcat2/apache-tomcat-7.0.82

#########tomcat3#######

export CATALINA_HOME_3=/home/webapp/tomcat3/apache-tomcat-7.0.82

export CATALINA_BASE_3=/home/webapp/tomcat3/apache-tomcat-7.0.82

export TOMCAT_HOME_3=/home/webapp/tomcat3/apache-tomcat-7.0.82

 

[root@WEBAPP95 webapp]# source /etc/profile #Environment variables take effect

Notice:

Except for the first tomcat, which does not need to be modified, the calalina.sh of tomcat2 and tomcat3 need to be added as follows:

【webapp@WEBAPP95 bin】vim catalina.sh

turn up

# OS specific support.  $var _must_ be set to either true or false.

Add the following code below

export CATALINA_HOME=$CATALINA_HOME_2

export CATALINA_BASE=$CATALINA_BASE_2

tomcat3 is also added here in turn.

 

Find the conf directory of tomcat and tomcat3
Open server.xml to change the port:
Modify the server.xml configuration and the first different startup and shutdown listening ports.
The modified example is as follows:
  <Server port="8015" shutdown="SHUTDOWN">                端口:8005->8015
<!-- Define a non-SSL HTTP/1.1 Connector on port 8080 -->
    <Connector port="18080" maxHttpHeaderSize="8192"        端口:8080->18080
maxThreads="150" minSpareThreads="25" maxSpareThreads="75"
               enableLookups="false" redirectPort="8443" acceptCount="100"
               connectionTimeout="20000" disableUploadTimeout="true" />
<!-- Define an AJP 1.3 Connector on port 8009 -->
    <Connector port="8019" Port: 8009->8019
               enableLookups="false" redirectPort="8443" protocol="AJP/1.3" />
 
 
Enter the bin directories of the three tomcats and start tomcat--./startup.sh
【Webapp @ WEBAPP95 bin】 ps -ef | grep tomcat 
Check whether there are 3 processes and whether the corresponding tomcat access path is correct.
http://localhost:8080
http://localhost:18080
http://localhost:28080
Is it normal to open?
[webapp@WEBAPP95 bin]sh shutdown.sh is it shut down normally.
After normal, you can put the war package in the tomcat main directory webapps
 

Guess you like

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