文档章节

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

again-Y
 again-Y
发布于 2013/04/17 10:58
字数 797
阅读 272
收藏 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
昌平
高级程序员
私信 提问
加载中

评论(0)

一个 tomcat 下如何部署多个项目?附详细步骤

一个tomcat下如何部署多个项目?Linux跟windows系统下的步骤都差不多,以下linux系统下部署为例。windows系统下部署同理。 一、不修改端口,部署多个项目 清楚tomcat目录结构的应该都知道,项...

豆姐姐
03/02
0
0
Tomcat7 部署两个项目(设置不同端口),为不同端口部署不同项目

目标:一个tomcat部署两个,甚至多个项目时,通过添加一个不同的端口号方式来实现 方法:配置Tomcat的server.xml配置文件,设置不同的访问路径。 第一步:先在tomcat目录下,复制一个webapps...

M_ling
04/20
0
0
Tomcat和它的几种“基本操作”,你学会了吗!!!

仅供参考 什么是 Tomcat Tomcat 简单来说就是一个 Java web 服务器,在中小型系统和并发量小的场合下被普遍使用,是开发和调试Servlet、JSP 程序的首选。 Tomcat 结构目录 bin:存放启动,关...

Alita-99
04/07
0
0
让Eclipse的TomcatPlugin支持Tomcat 8.x

使用tomcat插件启动项目的优势: 1.TomcatPlugin是一个免重启的开发插件,原始的Servers方式启动tomcat项目,修改xxx.ftl 或者 xxx.jsp 文件后需要重启tomcat后内容才能得到更新,而使用Tom...

osc_4g93n6bo
2018/07/17
3
0
一个tomcat服务器上部署多个Web项目,不同域名访问

【参考】一个tomcat服务器上部署多个项目,不同域名访问 我们一个服务器只按装了一个tomcat服务器,现在有多个项目或者多个域名访问,下面来进行配置 在这里我们只需要修改conf下的server.xm...

Rocken.li
2019/04/13
0
0

没有更多内容

加载失败,请刷新页面

加载更多

程序远自我修养

详见: https://leohxj.gitbooks.io/a-programmer-prepares/content/pm/good-product-manager.html

郭恩洲_OSC博客
36分钟前
15
0
使用git clone命令克隆文件出现error: RPC failed相关错误

使用git clone命令克隆文件出现error: RPC failed; curl 18 transfer closed with outstanding read data remain问题 笔者最近在使用git clone命令从github克隆源码到电脑时出现了以下问题 ...

独钓渔
今天
22
0
Java中JNI的使用详解第三篇:JNIEnv类型中方法的使用

在来看一下C++代码: #include<iostream.h> #include "com_jni_demo_JNIDemo.h" JNIEXPORT void JNICALL Java_com_jni_demo_JNIDemo_sayHello (JNIEnv * env, jobject obj) { //获取obj中对象......

天王盖地虎626
今天
21
0
直播撬动618变局:抖快凶猛、商家清醒

  文/鸿键   来源:深响(ID:deep-echo)   核心要点   直播带货热潮持续升温,今年的传统电商大促节 618 成了第一个“全民直播”的 618,直播带货不仅为电商带来增量,同时也搅动着行...

计算无敌
今天
30
0
《一天一模式》— 观察者模式

一、观察者模式的概念 观察者模式(又被称为发布-订阅(Publish/Subscribe)模式,属于行为型模式的一种,它定义了一种一对多的依赖关系,让多个观察者对象同时监听某一个主题对象。这个主题...

XuePeng77
昨天
13
0

没有更多内容

加载失败,请刷新页面

加载更多

返回顶部
顶部