码迷,mamicode.com
首页 > Web开发 > 详细

Tomcat server分端口部署web项目

时间:2015-01-22 17:40:57      阅读:96      评论:0      收藏:0      [点我收藏+]

标签:

<?xml version=‘1.0‘ encoding=‘utf-8‘?>

<Server port="8006" shutdown="SHUTDOWN">
  <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端口 -->
  <Service name="Catalina.app1">  <!-- 名称,创建成功后在conf/文件夹下面会生成该名称的文件夹 -->
    
    <!-- 设置访问的端口号7192 -->
    <Connector port="7192" protocol="HTTP/1.1"
               connectionTimeout="20000"
               redirectPort="8443" />

    <Connector port="8010" protocol="AJP/1.3" redirectPort="8443" />
    
    <!-- 注意名称,默认IP localhost -->
    <Engine name="Catalina.app1" defaultHost="localhost">

      <Realm className="org.apache.catalina.realm.LockOutRealm">
        <Realm className="org.apache.catalina.realm.UserDatabaseRealm"
               resourceName="UserDatabase"/>
      </Realm>
      
      <!-- 基准目录:tomcat/webapps发布目录 -->
      <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 &quot;%r&quot; %s %b" />
         <!-- 相对webapps/app1目录 -->       
         <Context path="/app1" docBase="app1" />
         
      </Host>
    </Engine>
  </Service>
  
  <!-- 配置第二个Service端口,参数配置同上 -->
  <Service name="Catalina.app2">

    <Connector port="7194" protocol="HTTP/1.1"
               connectionTimeout="20000"
               redirectPort="8443" />
   
    <Connector port="8010" protocol="AJP/1.3" redirectPort="8443" />

    <Engine name="Catalina.app2" 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 &quot;%r&quot; %s %b" />
         <Context path="/app2" docBase="app2" />
         
      </Host>
    </Engine>
  </Service>
  
  
</Server>

 

Tomcat server分端口部署web项目

标签:

原文地址:http://www.cnblogs.com/simpledev/p/4241751.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!