centos 多tomcat配置

/ java / 没有评论 / 291浏览

多tomcat配置

复制第二个tomcat

cp -r /www/server/tomcat /www/server/tomcat_qas

配置环境变量, JAVA和TOMCAT的环境变量

vim /etc/profile
##########first tomcat###########
CATALINA_BASE=/www/server/tomcat
CATALINA_HOME=/www/server/tomcat
TOMCAT_HOME=/www/server/tomcat
export CATALINA_BASE CATALINA_HOME TOMCAT_HOME
##########first tomcat############

##########second tomcat##########
CATALINA_QAS_BASE=/www/server/tomcat_qas
CATALINA_QAS_HOME=/www/server/tomcat_qas
TOMCAT_QAS_HOME=/www/server/tomcat_qas
export CATALINA_QAS_BASE CATALINA_QAS_HOME TOMCAT_QAS_HOME
##########second tomcat##########

修改tomcat的配置,第一个tomcat不用做修改,修改第二个tomcat,如果有多个,则第一个不用修改,其余都要

新增内容

export CATALINA_BASE=$CATALINA_QAS_BASE
export CATALINA_HOME=$CATALINA_QAS_HOME

或者用全部替换 alt

JAVA_OPTS="$JAVA_OPTS -Dspring.profiles.active=uat"
export JAVA_OPTS="$JAVA_OPTS -Xms512m -Xmx2048m -server"

修改tomcat端口

编辑/conf/server.xml

 <Connector port="8080" protocol="HTTP/1.1"
               connectionTimeout="20000"
               redirectPort="8443" />
    <Connector port="8009" protocol="AJP/1.3" redirectPort="8443" />

修改为

 <Connector port="8090" protocol="HTTP/1.1"
               connectionTimeout="20000"
               redirectPort="8443" />
    <Connector port="8019" protocol="AJP/1.3" redirectPort="8443" />