`

启动多个tomcat

    博客分类:
  • JAVA
阅读更多

想启动多个tomcat,只需修改conf/server.xml文件:

<?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
 -->
 <!--2步修改此端口,默认是8005-->
<Server port="8095" 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" />
  <!-- 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
    -->
	<!--1步修改此处的端口,默认是8080-->
    <Connector port="8888" protocol="HTTP/1.1" 
               connectionTimeout="20000" 
               redirectPort="8443" URIEncoding="utf-8"/>
    <!-- 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 -->
	<!--3步修改此处端口,默认为8009-->
    <Connector port="8099" 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="Standalone" 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>
    </Engine>
  </Service>
</Server>

 

0
3
分享到:
评论

相关推荐

    如何同时启动多个Tomcat服务器

    ### 如何同时启动多个Tomcat服务器 在现代的软件开发环境中,经常需要同时运行多个Tomcat服务器实例来满足不同的需求,比如开发、测试或者不同应用的独立部署等。本文将详细介绍如何配置并同时启动多个Tomcat服务器...

    怎样在同一系统中启动多个tomcat

    【怎样在同一系统中启动多个Tomcat】 在IT行业中,尤其是Web服务器管理方面,有时需要在同一台服务器上运行多个Tomcat实例,以隔离不同应用或防止单一应用故障影响其他服务。以下是如何在Windows和Linux系统中配置...

    同一系统里启动多个tomcat

    ### 在同一系统里启动多个Tomcat的详细指南 #### 一、引言 在实际的开发与运维工作中,有时会遇到需要在同一台机器上运行多个Tomcat实例的需求。这种需求通常出现在开发测试环境或者需要进行负载均衡的情况下。...

    如何在Linux下安装启动多个Tomcat

    ### 如何在Linux环境下安装并启动多个Tomcat实例 #### 标题与描述解析 文章标题:“如何在Linux下安装启动多个Tomcat”——本文旨在详细介绍如何在同一台Linux服务器上安装并启动多个Tomcat实例,并重点讲解如何...

    如何在同一系统里同时启动多个Tomcat

    由于Tomcat默认配置会占用特定的端口,因此如果要在同一系统上启动多个Tomcat实例,我们需要对每个实例的配置文件进行适当的修改,以确保它们之间不会发生端口冲突。 首先,我们要了解Tomcat主要使用的四个通讯端口...

    同时启动多个tomcat

    ### 同时启动多个Tomcat 在实际工作中,有时我们需要同时启动多个Tomcat服务器来满足不同的业务需求或者进行性能测试等。这对于初次接触Tomcat的新手管理员来说可能会遇到一定的挑战。本文将详细介绍如何通过简单的...

    一台服务器上启动多个tomcat

    ### 在一台服务器上启动多个Tomcat实例的详细指南 #### 标题与描述解析 - **标题**:“一台服务器上启动多个tomcat” - **描述**:“利用不同端口区别,同一台电脑上可启动多个tomcat” 这些信息提示我们本篇文章...

    同一windows启动多个tomcat.docx

    那么,如何在 Windows 平台下配置和启动多个 Tomcat 实例呢?本文将详细介绍在 Windows 平台下配置和启动多个 Tomcat 实例的步骤。 一、环境变量配置 在配置多个 Tomcat 实例之前,需要首先了解 Tomcat 的环境变量...

    怎样在同一系统中启动多个TOMCAT.doc

    ### 如何在同一系统中启动多个Tomcat实例 在IT领域,特别是Java Web开发环境中,Tomcat作为一款轻量级的应用服务器被广泛使用。有时出于安全考量或是为了提高系统的可用性,开发者会选择在同一台服务器上部署多个...

    一台服务器上同时启动多个tomcat

    在同一台服务器上启动多个Tomcat实例时,最核心的问题就是避免端口冲突。默认情况下,Tomcat监听的端口主要有三个:HTTP端口(8080)、Shutdown端口(8005)和AJP端口(8009)。每个端口都必须在不同的实例中设置为...

    linux下启动多tomcat

    在Linux环境下启动多个Tomcat服务器是一项常见的需求,尤其是在开发、测试或生产环境中,为了实现不同应用的隔离或者负载均衡,企业级项目往往需要部署多个独立的Tomcat实例。以下将详细解析如何在Linux系统中成功...

    修改tomcat端口号及同时启动多个tomat

    在同一台服务器上同时启动多个Tomcat实例,通常是为了满足开发测试或者负载均衡的需求。下面介绍具体的步骤。 #### 配置多个Tomcat实例 假设已经安装了两个Tomcat实例,分别命名为`Tomcat1`和`Tomcat2`。对于每个...

    linux中设置tomcat自启动

    因此,我们需要进入到这个目录下,以便创建和编辑与Tomcat相关的启动脚本。 ### 三、创建并打开Tomcat文件 使用vi或vim文本编辑器来创建一个新的文件,通常命名为 `tomcat` 或者更具体的名称如 `tomcat6`。在这个...

    linux安装多个tomcat

    在Linux系统中安装多个Tomcat服务器是常见的需求,特别是在开发和测试环境中,为了隔离不同的项目或者版本,每个项目可能需要独立的Tomcat实例。本文将详细介绍如何在Linux上安装和管理多个Tomcat。 首先,我们需要...

    Myeclipse配置多个Tomcat

    MyEclipse 配置多个 Tomcat 在 MyEclipse 中配置多个 Tomcat 是一种非常实用的方法尤其是在开发多个项目时...但是,我们需要注意的是,配置多个 Tomcat 需要修改一些配置文件,并且需要重新启动 MyEclipse 才能生效。

    一个或多个Tomcat做成windows服务自启动

    在Windows操作系统中,将一个或多个Tomcat实例配置为服务并实现开机自启动,是确保应用程序高可用性和持续运行的关键步骤。以下是如何操作的详细步骤: 1. **检查service.bat文件**:首先,确保你的Tomcat安装目录...

    Linux(CentOS7)安装Tomcat与设置Tomcat为开机启动项(tomcat8为例)

    Tomcat有多个版本,包括Tomcat7、Tomcat8和Tomcat9。当前,企业中广泛使用的是Tomcat8,因为它提供了更好的性能和稳定性。你可以从官方下载页面(https://tomcat.apache.org/download-80.cgi)获取所需版本。例如,...

Global site tag (gtag.js) - Google Analytics