Discuz! Board

 找回密码
 立即注册
搜索
热搜: 活动 交友 discuz
查看: 1642|回复: 0
打印 上一主题 下一主题

tomcat 配置两个项目

[复制链接]

32

主题

53

帖子

202

积分

认证用户组

Rank: 5Rank: 5

积分
202
跳转到指定楼层
楼主
发表于 2017-2-21 22:54:33 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
  1. <?xml version='1.0' encoding='utf-8'?>

  2. <Server port="8054" shutdown="SHUTDOWN">
  3.     <!-- Security listener. Documentation at /docs/config/listeners.html <Listener
  4.         className="org.apache.catalina.security.SecurityListener" /> -->
  5.     <!--APR library loader. Documentation at /docs/apr.html -->
  6.     <Listener className="org.apache.catalina.core.AprLifecycleListener"
  7.         SSLEngine="on" />
  8.     <!--Initialize Jasper prior to webapps are loaded. Documentation at /docs/jasper-howto.html -->
  9.     <Listener className="org.apache.catalina.core.JasperListener" />
  10.     <!-- Prevent memory leaks due to use of particular java/javax APIs -->
  11.     <Listener className="org.apache.catalina.core.JreMemoryLeakPreventionListener" />
  12.     <Listener className="org.apache.catalina.mbeans.GlobalResourcesLifecycleListener" />
  13.     <Listener className="org.apache.catalina.core.ThreadLocalLeakPreventionListener" />


  14.     <GlobalNamingResources>

  15.         <Resource name="UserDatabase" auth="Container"
  16.             type="org.apache.catalina.UserDatabase" description="User database that can be updated and saved"
  17.             factory="org.apache.catalina.users.MemoryUserDatabaseFactory"
  18.             pathname="conf/tomcat-users.xml" />
  19.     </GlobalNamingResources>


  20.     <Service name="Catalina">

  21.         <!--protocol 请使用nio2,或者apr -->

  22.         <Connector port="8080" protocol="HTTP/1.1"
  23.             connectionTimeout="20000" redirectPort="9543" />


  24.         <Connector port="8909" protocol="AJP/1.3" redirectPort="9543" />

  25.         <Engine name="Catalina" defaultHost="localhost">

  26.             <Realm className="org.apache.catalina.realm.LockOutRealm">

  27.                 <Realm className="org.apache.catalina.realm.UserDatabaseRealm"
  28.                     resourceName="UserDatabase" />
  29.             </Realm>

  30.             <Host name="localhost" appBase="webapps" unpackWARs="true"
  31.                 autoDeploy="true">

  32.                 <Valve className="org.apache.catalina.valves.AccessLogValve"
  33.                     directory="logs" prefix="localhost_access_log." suffix=".txt"
  34.                     pattern="%h %l %u %t "%r" %s %b"/>
  35.                 <Context path="/route" reloadable="true"
  36.                     docBase="/home/develop/tomcat-7.0.54/flatrass" />
  37.             </Host>
  38.         </Engine>
  39.     </Service>

  40.     <Service name="Catalina">
  41.         <!--把port改成8081 -->
  42.         <!--protocol 请使用nio2,或者apr -->
  43.         <Connector port="8081" protocol="HTTP/1.1"
  44.             connectionTimeout="20000" redirectPort="9543" />
  45.         <Connector port="8909" protocol="AJP/1.3" redirectPort="9543" />
  46.         <Engine name="Catalina" defaultHost="localhost">
  47.             <Realm className="org.apache.catalina.realm.LockOutRealm">
  48.                 <Realm className="org.apache.catalina.realm.UserDatabaseRealm"
  49.                     resourceName="UserDatabase" />
  50.             </Realm>
  51.             <Host name="localhost" appBase="webapps" unpackWARs="true"
  52.                 autoDeploy="true">
  53.                 <Valve className="org.apache.catalina.valves.AccessLogValve"
  54.                     directory="logs" prefix="localhost_access_log." suffix=".txt"
  55.                     pattern="%h %l %u %t "%r" %s %b"/>
  56.                 <Context path="/route" reloadable="true"
  57.                     docBase="/home/develop/tomcat-7.0.54/flatrasweats" />
  58.             </Host>
  59.         </Engine>
  60.     </Service>
  61. </Server>
复制代码
在tomcat中的conf目录中,在server.xml中的,<host/>节点中添加:
<Context path="/访问名称" docBase="项目地址 " debug="0" privileged="true">
</Context>
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

QQ|Archiver|手机版|小黑屋|firemail ( 粤ICP备15085507号-1 )

GMT+8, 2024-5-7 07:22 , Processed in 0.054121 second(s), 19 queries .

Powered by Discuz! X3

© 2001-2013 Comsenz Inc.

快速回复 返回顶部 返回列表