Tomcat內配置多個webapps監聽不同埠

大搜車-自娛發表於2012-04-16
按照以下方式修改service.xml檔案,可以在webapps同級目錄下建立webapps-pub這樣的資料夾,用來管理多個專案。此方法效能存在問題,可用於企業內部無需效能高的系統配置。

 <Service name="pub">
<Connector port="9877" protocol="HTTP/1.1"
connectionTimeout="20000"
redirectPort="9444" URIEncoding="UTF-8"/>
<Engine name="pub" defaultHost="localhost">
<Realm className="org.apache.catalina.realm.UserDatabaseRealm"
resourceName="UserDatabase"/>
<Host name="localhost" appBase="webapps-pub"
unpackWARs="true" autoDeploy="true"
xmlValidation="false" xmlNamespaceAware="false">
</Host>
</Engine>
</Service>

<Service name="config">
<Connector port="9876" protocol="HTTP/1.1"
connectionTimeout="20000"
redirectPort="9445" URIEncoding="UTF-8"/>
<Engine name="config" defaultHost="localhost">
<Realm className="org.apache.catalina.realm.UserDatabaseRealm"
resourceName="UserDatabase"/>
<Host name="localhost" appBase="webapps-config"
unpackWARs="true" autoDeploy="true"
xmlValidation="false" xmlNamespaceAware="false">
</Host>
</Engine>
</Service>

相關文章