当前位置: 代码迷 >> Web前端 >> Tomcat内配备多个webapps监听不同端口
  详细解决方案

Tomcat内配备多个webapps监听不同端口

热度:90   发布时间:2012-07-28 12:25:13.0
Tomcat内配置多个webapps监听不同端口
按照以下方式修改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>
  相关解决方案