(1) Modify the /etc/profile file. Add a set of java environment variables, and two sets of CATALINA environment variables (I didn't set this step, maybe because my Tomcat is a free version)
Remember to modify it to make it effective, use the command: source /etc/profile
JAVA_HOME=/usr/java/jdk1.7.0
PATH=$JAVA_HOME/bin:$PATH
CLASSPATH=.:$JAVA_HOME/lib/dt.jar:$JAVA_HOME/lib/tools.jar
export JAVA_HOME
export PATH
export CLASSPATH
#第一个Tomcat
export CATALINA_BASE=/usr/local/apache-tomcat-6.0.35
export CATALINA_HOME=/usr/local/apache-tomcat-6.0.35
#第二个Tomcat
export CATALINA_2_BASE=/usr/local/apache-tomcat-6.0.35-second
export CATALINA_2_HOME=/usr/local/apache-tomcat-6.0.35-second
(2). Modify the server.xml configuration and the first different startup and shutdown listening ports. The modified example is as follows:
<Server port="
8050
" shutdown="SHUTDOWN"> 端口:8049->8050
<!-- Define a non-SSL HTTP/1.1 Connector on port 8080 -->
<Connector port=" 9080 " maxHttpHeaderSize="8192" 端口:8080->9080
maxThreads="150" minSpareThreads="25" maxSpareThreads="75"
enableLookups="false" redirectPort="8443" acceptCount="100"
<!-- Define a non-SSL HTTP/1.1 Connector on port 8080 -->
<Connector port=" 9080 " maxHttpHeaderSize="8192" 端口:8080->9080
maxThreads="150" minSpareThreads="25" maxSpareThreads="75"
enableLookups="false" redirectPort="8443" acceptCount="100"
connectionTimeout="20000" disableUploadTimeout="true" />
(3) Open catalina.sh, tomcat/bin/ find the red letter below, add the following code below
# OS specific support. $var _must_ be set to either true or false.
# myself : add
export CATALINA_BASE=$CATALINA_2_BASE
# OS specific support. $var _must_ be set to either true or false.
# myself : add
export CATALINA_BASE=$CATALINA_2_BASE
export CATALINA_HOME=$CATALINA_2_HOME