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

Tomcat下为每个Web应用配置不同的访问端口

时间:2015-10-19 02:04:37      阅读:328      评论:0      收藏:0      [点我收藏+]

标签:tomcat不同端口不同应用


在server.xml中配置两个service为Catalina.app1和Catalina.app2

 <Service name="Catalina.app1">
    <Connector connectionTimeout="20000" port="8081" protocol="HTTP/1.1" redirectPort="8443"/>
    <Connector port="8009" protocol="AJP/1.3" redirectPort="8443"/>
    <Engine defaultHost="localhost" name="Catalina.app1"> 
      <Realm className="org.apache.catalina.realm.LockOutRealm">
        <Realm className="org.apache.catalina.realm.UserDatabaseRealm" resourceName="UserDatabase"/>
      </Realm>
      <Host appBase="webapps" autoDeploy="true" name="localhost" unpackWARs="true"> 
        <Valve className="org.apache.catalina.valves.AccessLogValve" directory="logs" pattern="%h %l %u %t &quot;%r&quot; %s %b" prefix="localhost_access_log." suffix=".txt"/>
      <Context docBase="D:\Program Files\apache-tomcat-7.0.62\webapps\test" path="" reloadable="true" source="org.eclipse.jst.jee.server:test"/></Host>
    </Engine>
  </Service>
  
  
  
  
  <Service name="Catalina.app2">
    <Connector connectionTimeout="20000" port="8082" protocol="HTTP/1.1" redirectPort="8443"/>
    <Connector port="8010" protocol="AJP/1.3" redirectPort="8443"/>
    <Engine defaultHost="localhost" name="Catalina.app2"> 
      <Realm className="org.apache.catalina.realm.LockOutRealm">
        <Realm className="org.apache.catalina.realm.UserDatabaseRealm" resourceName="UserDatabase"/>
      </Realm>
      <Host appBase="webapps" autoDeploy="true" name="localhost" unpackWARs="true"> 
        <Valve className="org.apache.catalina.valves.AccessLogValve" directory="logs" pattern="%h %l %u %t &quot;%r&quot; %s %b" prefix="localhost_access_log." suffix=".txt"/>
     <Context docBase="D:\Program Files\apache-tomcat-7.0.62\webapps\springmvc_hello" path="/springmvc_hello" reloadable="true" source="org.eclipse.jst.jee.server:springmvc_hello"/></Host>
    </Engine>
  </Service>


配置后启动tomcat

技术分享


参考文章:

http://wenku.baidu.com/link?url=CDX6-xdricOb_nrCqJj7GTPa3lu_tmg9DE5-SX6ZiSNidAtcqQwjniKeXgdTDAWx-R6iLlJVqTvJDIzlshhJIxvCqcTJFFh_13p_aoxMqm3


http://www.linuxidc.com/Linux/2012-06/62032p2.htm


本文出自 “一无所有 QQ:934033381” 博客,请务必保留此出处http://tianxingzhe.blog.51cto.com/3390077/1704006

Tomcat下为每个Web应用配置不同的访问端口

标签:tomcat不同端口不同应用

原文地址:http://tianxingzhe.blog.51cto.com/3390077/1704006

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