在 /etc/profile中配置多个tomcat
#tomcat7
export CATALINA_HOME7=/root/tomcat/tomcat5/apache-tomcat-9.0.16
export CATALINA_BASE7=/root/tomcat/tomcat5/apache-tomcat-9.0.16
export TOMCAT_HOME7=/root/tomcat/tomcat5/apache-tomcat-9.0.16
#tomcat路径
#tomcat8
export CATALINA_HOME8=/root/tomcat/tomcat6/apache-tomcat-9.0.13
export CATALINA_BASE8=/root/tomcat/tomcat6/apache-tomcat-9.0.13
export TOMCAT_HOME8=/root/tomcat/tomcat6/apache-tomcat-9.0.13
在 tomcat bin目录下catalina.sh加入新的路径
在# OS specific support. $var must be set to either true or false.后面加入
# OS specific support. $var _must_ be set to either true or false.
export CATALINA_BASE=$CATALINA_BASE7
export CATALINA_HOME=$CATALINA_HOME7
server.xml需修改三个地方的port
<Server port="8012" shutdown="SHUTDOWN">
<Listener className="org.apache.catalina.startup.VersionLoggerListener" />
<!-- Security listener. Documentation at /docs/config/listeners.html
<Listener className="org.apache.catalina.security.SecurityListener" />
-->
<!--APR library loader. Documentation at /docs/apr.html -->
<Listener className="org.apache.catalina.core.AprLifecycleListener" SSLEngine="on" />
<!-- Prevent memory leaks due to use of particular java/javax APIs-->
<Listener className="org.apache.catalina.core.JreMemoryLeakPreventionListener" />
<Listener className="org.apache.catalina.mbeans.GlobalResourcesLifecycleListener" />
<Listener className="org.apache.catalina.core.ThreadLocalLeakPreventionListener" />
<Connector port="8086" protocol="HTTP/1.1"
connectionTimeout="20000"
redirectPort="8443" />
<Connector port="8016" protocol="AJP/1.3" redirectPort="8443" />