Chinaunix首页 | 论坛 | 博客
  • 博客访问: 535090
  • 博文数量: 298
  • 博客积分: 0
  • 博客等级: 民兵
  • 技术积分: 3077
  • 用 户 组: 普通用户
  • 注册时间: 2019-06-17 10:57
文章分类

全部博文(298)

文章存档

2022年(96)

2021年(201)

2019年(1)

我的朋友

分类: Java

2022-03-18 11:12:26


点击(此处)折叠或打开


  1. 配置好的 server.xml  此文件在 conf文件夹下面

  2. <?xml version='1.0' encoding='utf-8'?>
  3. <!--
  4.   Licensed to the Apache Software Foundation (ASF) under one or more
  5.   contributor license agreements. See the NOTICE file distributed with
  6.   this work for additional information regarding copyright ownership.
  7.   The ASF licenses this file to You under the Apache License, Version 2.0
  8.   (the "License"); you may not use this file except in compliance with
  9.   the License. You may obtain a copy of the License at

  10.       http://www.apache.org/licenses/LICENSE-2.0

  11.   Unless required by applicable law or agreed to in writing, software
  12.   distributed under the License is distributed on an "AS IS" BASIS,
  13.   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  14.   See the License for the specific language governing permissions and
  15.   limitations under the License.
  16. -->
  17. <!-- Note: A "Server" is not itself a "Container", so you may not
  18.      define subcomponents such as "Valves" at this level.
  19.      Documentation at /docs/config/server.html
  20.  -->
  21. <Server port="8005" shutdown="SHUTDOWN">
  22.   <Listener className="org.apache.catalina.startup.VersionLoggerListener" />
  23.   <!-- Security listener. Documentation at /docs/config/listeners.html
  24.   <Listener className="org.apache.catalina.security.SecurityListener" />
  25.   -->
  26.   <!--APR library loader. Documentation at /docs/apr.html -->
  27.   <Listener className="org.apache.catalina.core.AprLifecycleListener" SSLEngine="on" />
  28.   <!--Initialize Jasper prior to webapps are loaded. Documentation at /docs/jasper-howto.html -->
  29.   <Listener className="org.apache.catalina.core.JasperListener" />
  30.   <!-- Prevent memory leaks due to use of particular java/javax APIs-->
  31.   <Listener className="org.apache.catalina.core.JreMemoryLeakPreventionListener" />
  32.   <Listener className="org.apache.catalina.mbeans.GlobalResourcesLifecycleListener" />
  33.   <Listener className="org.apache.catalina.core.ThreadLocalLeakPreventionListener" />

  34.   <!-- Global JNDI resources
  35.        Documentation at /docs/jndi-resources-howto.html
  36.   -->
  37.   <GlobalNamingResources>
  38.     <!-- Editable user database that can also be used by
  39.          UserDatabaseRealm to authenticate users
  40.     -->
  41.     <Resource name="UserDatabase" auth="Container"
  42.               type="org.apache.catalina.UserDatabase"
  43.               description="User database that can be updated and saved"
  44.               factory="org.apache.catalina.users.MemoryUserDatabaseFactory"
  45.               pathname="conf/tomcat-users.xml" />
  46.   </GlobalNamingResources>

  47.   <!-- A "Service" is a collection of one or more "Connectors" that share
  48.        a single "Container" Note: A "Service" is not itself a "Container",
  49.        so you may not define subcomponents such as "Valves" at this level.
  50.        Documentation at /docs/config/service.html
  51.    -->
  52.   <Service name="Catalina">

  53.     <!--The connectors can use a shared executor, you can define one or more named thread pools-->
  54.     <!--
  55.     <Executor name="tomcatThreadPool" namePrefix="catalina-exec-"
  56.         maxThreads="150" minSpareThreads="4"/>
  57.     -->


  58.     <!-- A "Connector" represents an endpoint by which requests are received
  59.          and responses are returned. Documentation at :
  60.          Java HTTP Connector: /docs/config/http.html (blocking & non-blocking)
  61.          Java AJP Connector: /docs/config/ajp.html
  62.          APR (HTTP/AJP) Connector: /docs/apr.html
  63.          Define a non-SSL HTTP/1.1 Connector on port 8080
  64.     -->
  65.     <Connector port="80" protocol="HTTP/1.1"
  66.                connectionTimeout="20000"
  67.                redirectPort="8443" />
  68.     <!-- A "Connector" using the shared thread pool-->
  69.     <!--
  70.     <Connector executor="tomcatThreadPool"
  71.                port="8080" protocol="HTTP/1.1"
  72.                connectionTimeout="20000"
  73.                redirectPort="8443" />
  74.     -->
  75.     <!-- Define a SSL HTTP/1.1 Connector on port 8443
  76.          This connector uses the BIO implementation that requires the JSSE
  77.          style configuration. When using the APR/native implementation, the
  78.          OpenSSL style configuration is required as described in the APR/native
  79.          documentation -->
  80.     <!--
  81.     <Connector port="8443" protocol="org.apache.coyote.http11.Http11Protocol"
  82.                maxThreads="150" SSLEnabled="true" scheme="https" secure="true"
  83.                clientAuth="false" sslProtocol="TLS" />
  84.     -->

  85.     <!-- Define an AJP 1.3 Connector on port 8009 -->
  86.     <Connector port="8009" protocol="AJP/1.3" redirectPort="8443" />


  87.     <!-- An Engine represents the entry point (within Catalina) that processes
  88.          every request. The Engine implementation for Tomcat stand alone
  89.          analyzes the HTTP headers included with the request, and passes them
  90.          on to the appropriate Host (virtual host).
  91.          Documentation at /docs/config/engine.html -->

  92.     <!-- You should set jvmRoute to support load-balancing via AJP ie :
  93.     <Engine name="Catalina" defaultHost="localhost" jvmRoute="jvm1">
  94.     -->
  95.     <Engine name="Catalina" defaultHost="localhost">

  96.       <!--For clustering, please take a look at documentation at:
  97.           /docs/cluster-howto.html (simple how to)
  98.           /docs/config/cluster.html (reference documentation) -->
  99.       <!--
  100.       <Cluster className="org.apache.catalina.ha.tcp.SimpleTcpCluster"/>
  101.       -->

  102.       <!-- Use the LockOutRealm to prevent attempts to guess user passwords
  103.            via a brute-force attack -->
  104.       <Realm className="org.apache.catalina.realm.LockOutRealm">
  105.         <!-- This Realm uses the UserDatabase configured in the global JNDI
  106.              resources under the key "UserDatabase". Any edits
  107.              that are performed against this UserDatabase are immediately
  108.              available for use by the Realm. -->
  109.         <Realm className="org.apache.catalina.realm.UserDatabaseRealm"
  110.                resourceName="UserDatabase"/>
  111.       </Realm>

  112.           <Host name="" appBase="webapps"
  113.             unpackWARs="true" autoDeploy="true">
  114.                  <Valve className="org.apache.catalina.valves.AccessLogValve" directory="logs"
  115.                  prefix="localhost_access_log." suffix=".txt"
  116.                  pattern="%h %l %u %t "%r" %s %b" />
  117.         </Host>

  118.         <Host name="" appBase="webapps2"
  119.             unpackWARs="true" autoDeploy="true">
  120.              <Valve className="org.apache.catalina.valves.AccessLogValve" directory="logs"
  121.              prefix="localhost_access_log." suffix=".txt"
  122.              pattern="%h %l %u %t "%r" %s %b" />
  123.          </Host>

  124.     </Engine>
  125.   </Service>
  126. </Server>

  127. 其中配置的关键是在

  128.         <Host name="" appBase="webapps"
  129.             unpackWARs="true" autoDeploy="true">
  130.                  <Valve className="org.apache.catalina.valves.AccessLogValve" directory="logs"
  131.                  prefix="localhost_access_log." suffix=".txt"
  132.                  pattern="%h %l %u %t "%r" %s %b" />
  133.         </Host>

  134.         <Host name="" appBase="webapps2"
  135.             unpackWARs="true" autoDeploy="true">
  136.              <Valve className="org.apache.catalina.valves.AccessLogValve" directory="logs"
  137.              prefix="localhost_access_log." suffix=".txt"
  138.              pattern="%h %l %u %t "%r" %s %b" />
  139.          </Host>

  140. 在tomcat 目录下面增加个文件夹 appBase="webapps"  appBase="webapps2"

  141. webapps 下面放域名1指向的项目   webapps2 下面放域名1指向的项目 


阅读(356) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~