Centos单机部署多个Tomcat
标签:Tomcat

Centos单机部署多个Tomcat

Step 1: 下载解压Tomcat

tar -zxvf apache-tomcat...

Step 2: 拷贝改名

mv /tomcat /usr/local/tomact1
cp -r /usr/local/tomcat1 /usr/local/tomcat2

Step 3: 修改 /etc/profile 增加tomcat环境变量

export CATALINA_BASE=/usr/local/tomcat1
export CATALINA_HOME=/usr/local/tomcat1
export TOMCAT_HOME=/usr/local/tomcat1
export CATALINA_2_BASE=/usr/local/tomcat2
export CATALINA_2_HOME=/usr/local/tomcat2
export TOMCAT_2_HOME=/usr/local/tomcat2

使配置文件生效

source /etc/profile

Step 4:修改tomcat2的catalina.sh

cd /usr/local/tomcat2/bin
vim catalina.sh
--找到 #OS specific support. $var _must_be set to either true or false
--在这行下面编辑,新增配置
export CATALINA_BASE=$CATALINA_2_BASE
export CATALINA_HOME=$CATALINA_2_HOME

Step 5: 修改tomcat2的conf目录下的server.xml

修改server port,将原来的8005改成9005

修改connetor port,将8080改成9080,并添加 URIEncoding="UTF-8"

修改另一个connetor port,将原来的8009改成9009

Step 6: 启动Tomcat

Step 7:测试

访问localhost:8080和localhost:9080

  • 2 min read

CONTRIBUTORS


  • 2 min read