以tomcat9为例
了解tomcat的几个主要端口(以下为默认配置)
主要的j几个个端口http端口(8080)、https端口(8443)、远程停服务端口(8005)、AJP端口(8009)
<Connector URIEncoding="UTF-8" connectionTimeout="60000" port="8080" protocol="HTTP/1.1" redirectPort="8443" useBodyEncodingForURI="true"/>
<Server port="8005" shutdown="SHUTDOWN">
<Connector port="8009" protocol="AJP/1.3" redirectPort="8443"/>
部署多个tomcat主要修改的三个端口
===tomcat1====
配置不需要修改
======tomcat2======
修改如下端口
在/usr/local/apache-tomcat-9.0.12/conf 下修改server.xml文件中三个端口
<Server port="8005" shutdown="SHUTDOWN"> <Connector port="8081" protocol="HTTP/1.1" connectionTimeout="20000" redirectPort="8443" /> <Connector port="8009" protocol="AJP/1.3" redirectPort="8443"/>
配置环境变量 vim /etc/profile
export CATALINA_2_BASE=/usr/local/apache-tomcat-9.0.12
export CATALINA_2_HOME=/usr/local/apache-tomcat-9.0.12
export TOMCAT_2_HOME=/usr/local/apache-tomcat-9.0.12
export CATALINA_HOME=/root/soft/apache-tomcat-9.0.7
export CATALINA_BASE=/root/soft/apache-tomcat-9.0.7
export TOMCAT_HOME=/root/soft/apache-tomcat-9.0.7
配置完成后执行命令: source /etc/profile 立即生效;
在tomcat2的catalina.sh文件下添加局部变量
CATALINA_BASE=$CATALINA_2_BASE
CATALINA_HOME=$CATALINA_2_HOME