文档章节

一个TOMcat配置多个项目server.xml配置

again-Y
 again-Y
发布于 2013/04/17 10:58
字数 797
阅读 119
收藏 0

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


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


  Unless required by applicable law or agreed to in writing, software
  distributed under the License is distributed on an "AS IS" BASIS,
  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  See the License for the specific language governing permissions and
  limitations under the License.
-->
<!-- Note:  A "Server" is not itself a "Container", so you may not
     define subcomponents such as "Valves" at this level.
     Documentation at /docs/config/server.html
 -->
<Server port="8005" shutdown="SHUTDOWN">


  <!--APR library loader. Documentation at /docs/apr.html -->
  <Listener className="org.apache.catalina.core.AprLifecycleListener" SSLEngine="on" />
  <!--Initialize Jasper prior to webapps are loaded. Documentation at /docs/jasper-howto.html -->
  <Listener className="org.apache.catalina.core.JasperListener" />
  <!-- Prevent memory leaks due to use of particular java/javax APIs-->
  <Listener className="org.apache.catalina.core.JreMemoryLeakPreventionListener" />
  <!-- JMX Support for the Tomcat server. Documentation at /docs/non-existent.html -->
  <Listener className="org.apache.catalina.mbeans.ServerLifecycleListener" />
  <Listener className="org.apache.catalina.mbeans.GlobalResourcesLifecycleListener" />


  <!-- Global JNDI resources
       Documentation at /docs/jndi-resources-howto.html
  -->
  <GlobalNamingResources>
    <!-- Editable user database that can also be used by
         UserDatabaseRealm to authenticate users
    -->
    <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>


  <!-- A "Service" is a collection of one or more "Connectors" that share
       a single "Container" Note:  A "Service" is not itself a "Container", 
       so you may not define subcomponents such as "Valves" at this level.
       Documentation at /docs/config/service.html
   -->
  <Service name="Catalina">
  
    <!--The connectors can use a shared executor, you can define one or more named thread pools-->
    <!--
    <Executor name="tomcatThreadPool" namePrefix="catalina-exec-" 
        maxThreads="150" minSpareThreads="4"/>
    -->
    
    
    <!-- A "Connector" represents an endpoint by which requests are received
         and responses are returned. Documentation at :
         Java HTTP Connector: /docs/config/http.html (blocking & non-blocking)
         Java AJP  Connector: /docs/config/ajp.html
         APR (HTTP/AJP) Connector: /docs/apr.html
         Define a non-SSL HTTP/1.1 Connector on port 8080
    -->
    <Connector port="8080" protocol="HTTP/1.1" 
               connectionTimeout="20000" 
               redirectPort="8443" />
    <!-- A "Connector" using the shared thread pool-->
    <!--
    <Connector executor="tomcatThreadPool"
               port="8080" protocol="HTTP/1.1" 
               connectionTimeout="20000" 
               redirectPort="8443" />
    -->           
    <!-- Define a SSL HTTP/1.1 Connector on port 8443
         This connector uses the JSSE configuration, when using APR, the 
         connector should be using the OpenSSL style configuration
         described in the APR documentation -->
    <!--
    <Connector port="8443" protocol="HTTP/1.1" SSLEnabled="true"
               maxThreads="150" scheme="https" secure="true"
               clientAuth="false" sslProtocol="TLS" />
    -->


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




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


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


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


      <!-- The request dumper valve dumps useful debugging information about
           the request and response data received and sent by Tomcat.
           Documentation at: /docs/config/valve.html -->
      <!--
      <Valve className="org.apache.catalina.valves.RequestDumperValve"/>
      -->


      <!-- This Realm uses the UserDatabase configured in the global JNDI
           resources under the key "UserDatabase".  Any edits
           that are performed against this UserDatabase are immediately
           available for use by the Realm.  -->
      <Realm className="org.apache.catalina.realm.UserDatabaseRealm"
             resourceName="UserDatabase"/>


      <!-- Define the default virtual host
           Note: XML Schema validation will not work with Xerces 2.2.
       -->
      <Host name="localhost"  appBase="webapps"
            unpackWARs="true" autoDeploy="true"
            xmlValidation="false" xmlNamespaceAware="false">


        <!-- SingleSignOn valve, share authentication between web applications
             Documentation at: /docs/config/valve.html -->
        <!--
        <Valve className="org.apache.catalina.authenticator.SingleSignOn" />
        -->


        <!-- Access log processes all example.
             Documentation at: /docs/config/valve.html -->
        <!--
        <Valve className="org.apache.catalina.valves.AccessLogValve" directory="logs"  
               prefix="localhost_access_log." suffix=".txt" pattern="common" resolveHosts="false"/>
        -->
      </Host>


<Host name="www.abc.com" debug="0" appBase="XXX/temp" unpackWARs="true" autoDeploy="true"  xmlValidation="false" xmlNamespaceAware="false">
                 <Context path="" docBase="XXX/abc(工程名)" debug="0" reloadable="true" crossContext="true"></Context>
                 <Context path="/jwchat" docBase="XXX/jwchat" debug="0" reloadable="true" crossContext="true"></Context>
                 <Context path="/chat_uploads" docBase="XXX/chat_uploads" debug="0" reloadable="true" crossContext="true"></Context>
                                                            </Host>
<Host name="www.efg.com" debug="0" appBase="XXX/temp" unpackWARs="true" autoDeploy="true"  xmlValidation="false" xmlNamespaceAware="false">
                 <Context path="" docBase="XXX/efg(工程名)" debug="0" reloadable="true" crossContext="true"></Context>
                                                            </Host>


    </Engine>
  </Service>

</Server>



同时,修改C:\WINDOWS\system32\drivers\etc下host文件

127.0.0.1       www.abc.com
127.0.0.1       www.efg.com


© 著作权归作者所有

共有 人打赏支持
again-Y
粉丝 24
博文 131
码字总数 11393
作品 0
昌平
高级程序员
windows下tomcat 发布多个web项目(多个域名,同一ip)

windows下tomcat 发布多个web项目(多个域名,同一ip) 公司有个项目,需要在同一个Tomcat服务器上,部署多个应用,这样,就是一个IP地址对应不同的web项目。 在tomcat的conf目录修改server....

shijilaile
2013/08/18
0
0
WEB请求处理四:Tomcat配置实践

WEB请求处理 WEB请求处理一:浏览器请求发起处理 WEB请求处理二:Nginx请求反向代理 WEB请求处理三:Servlet容器请求处理 WEB请求处理四:Tomcat配置实践 上篇文章《WEB请求处理三:Servlet...

陶邦仁
2016/07/05
332
2
Tomcat建立虚拟主机

一、需求和解决思路: 在项目经验中,主机的TCP协议(HTTP协议是基于TCP/IP协议)的80端口是稀缺资源,很多情况下不可能为一个应用而去申请一台主机(不管是物理主机还是虚拟服务器)。这时候...

clmsg
2016/08/18
37
0
nginx负载均衡多台tomcat,session共享,session丢失

用loadrunner负载测试了一下一个项目,结果发现,并发量在70的时候,响应时间已经达到了30秒,这是不能忍受的。再次负载100个并发,tomcat挂了,session丢失率9成多。 考虑到多并发,搭载ngi...

szu_吴鹏
2013/05/13
0
10
tomcat instance

一、前言 以前一直不太明白CATALINAHOME与CATALINABASE有什么不同,那时一般都是把多个项目同时部署到一个tomcat实例中,因此在配置环境变量的时候也就只配了CATALINAHOME,并没有配过CATAL...

_冢彧
2014/12/17
0
2

没有更多内容

加载失败,请刷新页面

加载更多

CentOS7.X部署Zabbix4.0

环境搭建 在CenOS7.X里面部署Zabbix最好先搭建好环境,我这里使用的是PHP+MariaDB+httpd部署的。 部署PHP环境: yum install -y php php-php-fpm 修改 PHP 参数以安装 ZABBIX 的安装需求: ...

寰宇01
16分钟前
1
0
工厂模式

(从别人里copy的,方便自己查看) 意图:定义一个创建对象的接口,让其子类自己决定实例化哪一个工厂类,工厂模式使其创建过程延迟到子类进行。 主要解决:主要解决接口选择的问题。 何时使...

南桥北木
42分钟前
1
0
rabbitmq学习(一)

RabbitMQ是目前非常热门的一款消息中间件,具有高可靠、易拓展、高可用及丰富的功能 1.什么是消息中间件 消息是指在应用间传送的数据。包含文本字符串、JSON、内嵌对象 消息队列中间件(消息...

hensemlee
45分钟前
1
0
学习设计模式——原型模式

1. 认识原型模式 1. 定义:用原型实例指定创建对象的种类,并通过拷贝这些原型创建新的对象。 2. 结构: Prototype:声明一个克隆自身的接口,用来约束想要克隆自己的具体实现类,要求这些类...

江左煤郎
51分钟前
1
0
观察者模式

观察者模式的套路 有如下角色: 事件,比如修改,用户点击; 事件队列,触发事件之后,会把事件一个一个放入事件队列 监听器,采用某种方式(一般是轮询,或者io阻塞机制),来判断事件队列是否有新的未...

黄威
55分钟前
1
0

没有更多内容

加载失败,请刷新页面

加载更多

返回顶部
顶部