文档章节

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

again-Y
 again-Y
发布于 2013/04/17 10:58
字数 797
阅读 120
收藏 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
粉丝 25
博文 131
码字总数 11393
作品 0
昌平
高级程序员
私信 提问
windows下tomcat 发布多个web项目(多个域名,同一ip)

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

shijilaile
2013/08/18
0
0
关于Tomcat配置域名的默认访问页面

近来需要上线一个对接支付宝支付的电商项目,需要去支付宝平台审核支付网站,所以需要配置正式域名的默认访问地址,折腾了一点时间,所以在这里记录一下。 1.配置80端口,在tomcat的server....

Nojur
05/25
0
0
nginx负载均衡多台tomcat,session共享,session丢失

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

szu_吴鹏
2013/05/13
0
10
WEB请求处理四:Tomcat配置实践

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

陶邦仁
2016/07/05
332
2
一个Tomcat运行多个实例

本文介绍在同一个tomcat下运行mydomain.com和mysite.com这两个实例的步骤。 有时候,我们希望周期性的更新Tomcat;有时候,我们又想统一管理安装在一台机器上的tomcat(比如让tomcat版本统一...

小湘西
2016/09/21
36
0

没有更多内容

加载失败,请刷新页面

加载更多

学习LinkedBlockingDeque源码

之前已经看了实现deque接口的ArrayDeque, ConcurrentLinkedDeque, LinkedList,也不能落下ConcurrentLinkedDeque,但是好像没在项目中用过。 这里看到实现的接口还有BlockingDeque<E>, Block...

woshixin
13分钟前
0
0
实战:用Python实现随机森林

摘要: 随机森林如何实现?为什么要用随机森林?看这篇足够了! 因为有Scikit-Learn这样的库,现在用Python实现任何机器学习算法都非常容易。实际上,我们现在不需要任何潜在的知识来了解模型...

阿里云官方博客
16分钟前
0
0
进程管理利器Supervisor--centos7下安装与卸载

目录 概述 环境准备 检查python环境 在线安装 配置Supervisor 启动并验证 概述 Supervisor的安装可以有在线安装和离线安装两种方式。安装方式取决于服务器是否联网,联网的话可采用在线安装,...

java_龙
23分钟前
2
0
spring系列汇总

spring spring-基于可扩展Schema的特性自定义标签 springmvc-同一个访问资源,多种视图解析方式 spring cache 配置使用aspectj模式织入 基于注解的spring缓存,轻松无侵入解决cache问题 spri...

细肉云吞
23分钟前
2
0
vsftpd搭建ftp

12月10日任务 14.4 exportfs命令 14.5 NFS客户端问题 15.1 FTP介绍 15.2/15.3 使用vsftpd搭建ftp exportfs命令 在nfs运行后的一段时间内,如果需要添加共享目录,这时需要修改exports文件,并...

robertt15
26分钟前
2
0

没有更多内容

加载失败,请刷新页面

加载更多

返回顶部
顶部