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>

你可能感兴趣的:(apache)