在CentOS下安装两个Tomcat
【版权声明:本文为博主原创文章,转载请说明出处。希望能和大家共同学习】
1.不同的tomcat启动和关闭监听不同的端口
2.不同的tomcat的启动文件startup.sh 中要指定各自的CATALINA_HOME和CATALINA_BASE这两个环境变量。 
具体配置如下:
jdk环境变量配置:
JAVA_HOME=/usr/java/jdk1.7.0_71
JAVA_BIN=/usr/java/jdk1.7.0_71/bin
PATH=$JAVA_HOME/bin:$PATH
CLASSPATH=.:$JAVA_HOME/lib/dt.jar:$JAVA_HOME/lib/tools.jar
export JAVA_HOME JAVA_BIN PATH CLASSPATH
#Tomcat配置如下:(tomcat1所有配置均不需要修改,只修改tomcat2即可)
#Tomcat1为:tomcat,Tomcat2为tomcat2
(1)在/etc/profile中添加以下粗体的配置
#原有的tocmat配置
#tomcat
TOMCAT_HOME=/usr/local/tomcat
CATALINA_BASE=/usr/local/tomcat
CATALINA_HOME=/usr/local/tomcat
export TOMCAT_HOME CATALINA_BASE CATALINA_HOME
#添加的tocmat配置,可照此样添加多个tomcat
#tomcat2
TOMCAT_2_HOME=/usr/local/tomcat2
CATALINA_2_BASE=/usr/local/tomcat2
CATALINA_2_HOME=/usr/local/tomcat2
export TOMCAT_2_HOME CATALINA_2_BASE CATALINA_2_HOME
(2)修改tomcat2的bin/shutdown.sh,在exec "$PRGDIR"/"$EXECUTABLE" stop "$@"这行前边添加如下配置:
export JAVA_HOME=/usr/java/jdk1.7.0_71
export PATH=$JAVA_HOME/bin:$PATH
export CLASSPATH=$JAVA_HOME/lib
export CATALINA_HOME=$CATALINA_2_HOME
export CATALINA_BASE=$CATALINA_2_BASE
(3)修改tomcat2的bin/startup.sh,在exec "$PRGDIR"/"$EXECUTABLE" stop "$@"这行前边添加如下配置:
export JAVA_HOME=/usr/java/jdk1.7.0_71
export PATH=$JAVA_HOME/bin:$PATH
export CLASSPATH=$JAVA_HOME/lib
export CATALINA_HOME=$CATALINA_2_HOME
export CATALINA_BASE=$CATALINA_2_BASE
(4)修改tocmat2的conf/server.xml,更改端口
。。。。。。
 
   
connectionTimeout="20000" edirectPort="8443" URIEncoding="UTF-8" maxHttpHeaderSize="8192" maxThreads="1000" enableLookups="false" compression="on" compressionMinSize="2048" compressableMimeType="text/html,text/xml,text/javascript,text/css,text/plain" disableUploadTimeout="true" useBodyEncodingForURI="true" />
   
               redirectPort="8443" />
   
     
             resourceName="UserDatabase"/>
     
            unpackWARs="true"
            xmlValidation="false" xmlNamespaceAware="false">
     
   
 
posted on 2017-06-08 16:59  Sandm-1  阅读(111)  评论(0编辑  收藏  举报