生活随笔
收集整理的這篇文章主要介紹了
Tomcat下部署多个项目
小編覺(jué)得挺不錯(cuò)的,現(xiàn)在分享給大家,幫大家做個(gè)參考.
轉(zhuǎn)載地址:http://blog.csdn.net/philosophyatmath/article/details/30246631
同一端口號(hào)的多個(gè)項(xiàng)目部署
??? 添加:
?
<Context?path="/route"?reloadable="true"?docBase="/home/develop/tomcat-7.0.54/flatrass"/>??<Context?path="/route2"?reloadable="true"?docBase="/home/develop/tomcat-7.0.54/flatrasweats"/>?? 通過(guò)訪問(wèn):http://127.0.0.1:8080/route??http://127.0.0.1:8080/route2?對(duì)應(yīng)各子的項(xiàng)目
?
?
?
?
?
?
?
對(duì)應(yīng)不同端口號(hào)的多個(gè)項(xiàng)目部署
通過(guò)訪問(wèn):http://127.0.0.1:8080/route??http://127.0.0.1:8081/route?對(duì)應(yīng)各子的項(xiàng)目????????
??????? 打開(kāi)conf文件夾server.xml文件,添加
[html]?view plaincopy
<Context?path="/route"?reloadable="true"?docBase="/home/develop/tomcat-7.0.54/flatrass"/>??
??????? 在service標(biāo)簽下面寫一個(gè)service標(biāo)簽。復(fù)制上面service,再修改里面的端口號(hào)為8081。添加:
[html]?view plaincopy
<Context?path="/route"?reloadable="true"?docBase="/home/develop/tomcat-7.0.54/flatrasweats"/>?? ?
?
[html]?view plaincopy
<?xml?version='1.0'?encoding='utf-8'?>????<Server?port="8054"?shutdown="SHUTDOWN">????<!--?Security?listener.?Documentation?at?/docs/config/listeners.html????<Listener?className="org.apache.catalina.security.SecurityListener"?/>????-->??????<Listener?className="org.apache.catalina.core.AprLifecycleListener"?SSLEngine="on"?/>??????<Listener?className="org.apache.catalina.core.JasperListener"?/>??????<Listener?className="org.apache.catalina.core.JreMemoryLeakPreventionListener"?/>????<Listener?className="org.apache.catalina.mbeans.GlobalResourcesLifecycleListener"?/>????<Listener?className="org.apache.catalina.core.ThreadLocalLeakPreventionListener"?/>?????????<GlobalNamingResources>?????????<Resource?name="UserDatabase"?auth="Container"????????????????type="org.apache.catalina.UserDatabase"????????????????description="User?database?that?can?be?updated?and?saved"????????????????factory="org.apache.catalina.users.MemoryUserDatabaseFactory"????????????????pathname="conf/tomcat-users.xml"?/>????</GlobalNamingResources>????????<Service?name="Catalina">??????????<Connector?port="8080"?protocol="HTTP/1.1"?????????????????connectionTimeout="20000"?????????????????redirectPort="9543"?/>?????????????<Connector?port="8909"?protocol="AJP/1.3"?redirectPort="9543"?/>????????<Engine?name="Catalina"?defaultHost="localhost">??????????<Realm?className="org.apache.catalina.realm.LockOutRealm">?????????????<Realm?className="org.apache.catalina.realm.UserDatabaseRealm"?????????????????resourceName="UserDatabase"/>????????</Realm>??????????<Host?name="localhost"??appBase="webapps"??????????????unpackWARs="true"?autoDeploy="true">????????????<Valve?className="org.apache.catalina.valves.AccessLogValve"?directory="logs"?????????????????prefix="localhost_access_log."?suffix=".txt"?????????????????pattern="%h?%l?%u?%t?"%r"?%s?%b"?/>??????<Context?path="/route"?reloadable="true"?docBase="/home/develop/tomcat-7.0.54/flatrass"/>????????</Host>?????????</Engine>??????</Service>???????????<Service?name="Catalina">???????????<Connector?port="8081"?protocol="HTTP/1.1"?????????????????connectionTimeout="20000"?????????????????redirectPort="9543"?/>??????????<Connector?port="8909"?protocol="AJP/1.3"?redirectPort="9543"?/>??????<Engine?name="Catalina"?defaultHost="localhost">????????<Realm?className="org.apache.catalina.realm.LockOutRealm">??????????<Realm?className="org.apache.catalina.realm.UserDatabaseRealm"?????????????????resourceName="UserDatabase"/>????????</Realm>????????<Host?name="localhost"??appBase="webapps"??????????????unpackWARs="true"?autoDeploy="true">??????????<Valve?className="org.apache.catalina.valves.AccessLogValve"?directory="logs"?????????????????prefix="localhost_access_log."?suffix=".txt"?????????????????pattern="%h?%l?%u?%t?"%r"?%s?%b"?/>??????????<Context??path="/route"?reloadable="true"?docBase="/home/develop/tomcat-7.0.54/flatrasweats"/>????????</Host>??????</Engine>????</Service>??</Server>?? ?
?
Java?home set :
setclasspath.sh
export JAVA_HOME=/home/qatest/jdk1.8.0_91
export JRE_HOME=/home/qatest/jdk1.8.0_91/jre
?
?
?
?
web.xml的加載過(guò)程是:
context-param -> listener -> filter -> servlet?
其它:
service httpd status
service httpd restart
lsof -i:80
chmod +x catalina.sh
ps –ef|grep tomcat
rm –rf file
啟動(dòng)tomcat #?? ./startup.sh
關(guān)閉tomcat #?? ./shutdown.sh
查看是否啟動(dòng)成功可以輸入ps axuwf|grep java,如果出現(xiàn)一大堆結(jié)果,就是啟動(dòng)成功了.
也可以netstat -lnpt,查看8088端口有沒(méi)有被使用.如果被使用了,說(shuō)明啟動(dòng)成功了.
轉(zhuǎn)載于:https://www.cnblogs.com/ceshi2016/p/6031203.html
總結(jié)
以上是生活随笔為你收集整理的Tomcat下部署多个项目的全部?jī)?nèi)容,希望文章能夠幫你解決所遇到的問(wèn)題。
如果覺(jué)得生活随笔網(wǎng)站內(nèi)容還不錯(cuò),歡迎將生活随笔推薦給好友。