編號 | 檔案放置目錄 | 欲設定的網站存取路徑 |
1 | /usr/tomcat | http://IP:8080/ |
2 | /usr/tomcat2 | http://IP:9080/ |
也就是直接tomcat解壓縮的檔案複製一份到tomcat2目錄
修改系統環境變量(vi etc/environment)
JAVA_HOME="/usr/java/jdk1.6.0_38" (JDK檔案放置目錄)
CATALINA_HOME="/usr/tomcat" (tomcat檔案放置目錄)
CATALINA_HOME2="/usr/tomcat2" (tomcat2檔案放置目錄)
CATALINA_BASE="/usr/tomcat"(tomcat1目錄)
CATALINA_BASE2="/usr/tomcat2"(tomcat2目錄)
修改tomcat2目錄下bin/
修改tomcat2/bin/catalina.sh (vi tomcat2/bin/catalina.sh)
把CATALINA_HOME全部替換成CATALINA_HOME2
(按esc鍵, vi指令為:1,$s/CATALINA_HOME/CATALINA_HOME2/g);
CATALINA_BASE換成CATALINA_BASE2
(按esc鍵, vi指令為:1,$s/CATALINA_BASE/CATALINA_BASE2/g)
- <Server port="9005" shutdown="SHUTDOWN"> 預設port="8005"
- <Connector port="9080" protocol="HTTP/1.1" connectionTimeout="20000" redirectPort="8443" URIEncoding="UTF-8" /> 預設port="8080"
- <Connector port="9009" protocol="AJP/1.3" redirectPort="8443" URIEncoding="UTF-8"/> 預設port="8009"
重開機後,個別重新啟動
./usr/tomcat/bin/startup.sh
./usr/tomcat2/bin/startup.sh
就可以看到成果