Linux系统下怎样配置多个Tomcat同时运行呢,首先修改变量为第一个tomcat,然后修改第二个tomcat启动的脚本
1、修改 对应tomcat中的 catalina.sh,添加环境变量:(区分两个名称即可)
#vi catalina.sh
export CATALINA_BASE=$CATALINA_0_BASE
export CATALINA_HOME=$CATALINA_0_HOME
2、 修改 tomcat的配置文件 server.xml:
修改下面标记的端口即可,防止端口占用:
<!-- A "Connector" represents an endpoint by which requests are received
and responses are returned. Documentation at :
Java HTTP Connector: /docs/config/http.html
Java AJP Connector: /docs/config/ajp.html
APR (HTTP/AJP) Connector: /docs/apr.html
Define a non-SSL/TLS HTTP/1.1 Connector on port 8080
-->
<Connector port="8081" protocol="HTTP/1.1"
connectionTimeout="20000"
redirectPort="8443" />
<!-- A "Connector" using the shared thread pool-->
<!--
<Connector executor="tomcatThreadPool"
port="8080" protocol="HTTP/1.1"
connectionTimeout="20000"
redirectPort="8443" />
-->
<!-- Define a SSL/TLS HTTP/1.1 Connector on port 8443
This connector uses the NIO implementation. The default
SSLImplementation will depend on the presence of the APR/native
library and the useOpenSSL attribute of the
AprLifecycleListener.
Either JSSE or OpenSSL style configuration may be used regardless of
the SSLImplementation selected. JSSE style configuration is used below.
-->
3、修改环境变量
#vi /etc/profile
####### 工程1 tomcat1#######
export CATALINA_BASE=/data/server/tomcat
export CATALINA_HOME=$CATALINA_BASE
export TOMCAT_HOME=$CATALINA_BASE
####### 工程2 tomcat2#######
export CATALINA_2_BASE=/data/tomcat-upgrade
export CATALINA_2_HOME=$CATALINA_2_BASE
export TOMCAT_2_HOME=$CATALINA_2_BASE
####### 工程3 tomcat3#######
export CATALINA_3_BASE=/data/tomcat-ifengSearch
export CATALINA_3_HOME=$CATALINA_3_BASE
export TOMCAT_3_HOME=$CATALINA_3_BASE
######## JAVA jdk 环境 #########
export JAVA_HOME=/data/jdk1.7
export PATH=$JAVA_HOME/bin:$PATH
export CLASSPATH=.:$JAVA_HOME/lib/dt.jar:$JAVA_HOME/lib/tools.jar
保存退出。
#source /etc/profile