1. 程式人生 > 其它 >Linux中安裝多個tomcat

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">

//8087http<Connector port="8087" protocol="HTTP/1.1" connectionTimeout="20000" redirectPort="8443" />

//8021AJP埠,Apache能通過AJP協議訪問Tomcat8006

<Connector port="8021" protocol="AJP/1.3" redirectPort="8443" />

Apache-tomcat-2;

//8012遠端停服務埠 

<Server port="8012" shutdown="SHUTDOWN">

//8088http<Connector port="8088" protocol="HTTP/1.1" connectionTimeout="20000" redirectPort="8443" />

//8022AJP埠,Apache能通過AJP

協議訪問Tomcat8006

<Connector port="8022" protocol="AJP/1.3" redirectPort="8443" />

Apache-tomcat-3;

//8013遠端停服務埠

<Server port="8013" shutdown="SHUTDOWN">

//8089http<Connector port="8089" protocol="HTTP/1.1" connectionTimeout="20000" redirectPort="8443" />

//8023AJP埠,Apache能通過AJP協議訪問Tomcat8006

<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

看看是否都可以訪問;