Linux中安装多个tomcat
1、之前安装了tomcat,所以现在把解压完成后的apache-tomcat复制三份;
2、创建三个tomcat文件夹,分别把apache-tomcat-1,2,3 放入进去;
3、依次修改以下三个端口:
vim /usr/local/tomcat/apache-tomcat-1/conf/server.xml
Apache-tomcat-1;
//8011远程停服务端口
<Server port="8011" shutdown="SHUTDOWN">
//8087为http端口 <Connector port="8087" protocol="HTTP/1.1" connectionTimeout="20000" redirectPort="8443" />
//8021为AJP端口,Apache能通过AJP协议访问Tomcat的8006端口
<Connector port="8021" protocol="AJP/1.3" redirectPort="8443" />
Apache-tomcat-2;
//8012远程停服务端口
<Server port="8012" shutdown="SHUTDOWN">
//8088为http端口 <Connector port="8088" protocol="HTTP/1.1" connectionTimeout="20000" redirectPort="8443" />
//8022为AJP端口,Apache能通过AJP协议访问Tomcat的8006端口
<Connector port="8022" protocol="AJP/1.3" redirectPort="8443" />
Apache-tomcat-3;
//8013远程停服务端口
<Server port="8013" shutdown="SHUTDOWN">
//8089为http端口 <Connector port="8089" protocol="HTTP/1.1" connectionTimeout="20000" redirectPort="8443" />
//8023为AJP端口,Apache能通过AJP协议访问Tomcat的8006端口
<Connector port="8023" protocol="AJP/1.3" redirectPort="8443" />
分别加入防火墙:
firewall-cmd --add-port=8087/tcp --permanent
firewall-cmd --add-port=8087/udp --permanent
firewall-cmd --reload
为了验证方便,修改tomcat首页
/usr/local/tomcat/apache-tomcat-1/webapps/ROOT,打开index.jsp文件,把Home 分别改成Home8087,Home8088,Home8089
打开浏览器,分别访问:
192.168.52.129:8088;192.168.52.129:8086;192.168.52.129:8087
看看是否都可以访问;