`

启用两个端口的问题

 
阅读更多

首先是对于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
 -->
<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" />
  <!-- 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>
    </Engine>
  </Service>
</Server>

 

启动Eclipse,运行其中的一个项目,在windows-preferences-server-Runtime Environment下的

remove掉



 

修改server.xml文件,

我修改成了8090端口

<?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="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" />
  <!-- 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="8090" 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="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="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>
    </Engine>
  </Service>
</Server>

 

,在启动startup.bat,这样子 就可以两个端口一起用了

  • 大小: 5 KB
分享到:
评论

相关推荐

    Springboot启用多个监听端口代码实例

    在 Springboot 框架中,默认情况下只能监听一个端口,但是在某些情况下,我们需要启用多个监听端口,例如在 web 端的接口需要有 web 安全相关的整改,但是对内的接口并不需要。因此,服务需要多个端口启动。 首先,...

    windows下nginx配置https以及同一个端口监听多个网站即监听多个虚拟主机

    - 注意:如果两个站点需要监听同一个端口(如443),则需要通过`server_name`指令来区分不同的请求。 4. 反向代理: Nginx的反向代理功能允许将来自客户端的请求转发到后端服务器。例如,我们可以配置`site1.com`...

    详解nginx同一端口监听多个域名和同时监听http与https

    针对这两个需求,本文将详细介绍如何在Nginx中实现。 首先,关于同一端口监听多个域名。这是一个非常实用的功能,尤其是在公网IP资源稀缺的当下。通过使用Nginx的虚拟主机功能,可以在同一个IP地址和端口上,通过...

    (Apache & IIS)同一个IP的同一个端口,绑定多个域名

    例如,在上面的例子中,定义了两个虚拟主机,分别对应`szwpc.51vip.biz` 和 `szwpc.oicp.net`,并且指定了不同的文档根目录。 #### IIS配置知识点 **1. 绑定多个域名** 在IIS中,通过为不同的网站设置不同的绑定...

    解决vue中使用proxy配置不同端口和ip接口问题

    本文介绍了在Vue项目中处理不同端口和IP接口配置问题的两种思路。首先是在`vue.config.js`中配置代理规则,用于解决开发阶段的跨域请求问题。其次是在公共目录下存储接口配置信息,以动态地适配后端环境的变更,便于...

    Java多线程端口快速扫描

    在这个端口扫描程序中,通常会采用实现Runnable接口的方法,因为这样可以避免单继承的限制,同时可以通过Thread类的构造函数创建新的线程实例。 1. **线程的创建与执行** - 实现Runnable接口:创建一个类,实现`...

    USB接口禁用启用软件

    "enableusb.exe"和"disableusb.exe"是两个关键的可执行文件,它们构成了这个USB接口禁用启用软件的核心功能。enableusb.exe用于开启USB接口,而disableusb.exe则用于关闭USB接口。这些程序通常不需要安装,只需双击...

    梦想服务器端口检测33891997

    标题“梦想服务器端口检测33891997”和描述“梦想服务器端口检测33891997 大家加载吧”表明这是一个关于服务器端口扫描的工具或教程,重点关注的是3389和1997这两个端口号。3389是微软远程桌面协议(RDP)的默认端口...

    Linux操作系统下SSH默认22端口修改方法.docx

    之所以先设置成两个端口,测试成功后再关闭一个端口,是为了防止在修改conf的过程中,万一出现掉线、断网、误操作等未知情况时候,还能通过另外一个端口连接上去调试,以免发生连接不上必须派人去机房,导致问题更加...

    vsftp修改默认端口方法

    添加如下两条规则以允许新的FTP端口以及被动模式端口通过: ```bash -A INPUT -p tcp --dport 6069 -j ACCEPT -A INPUT -p tcp --dport 10221:10231 -j ACCEPT ``` 更新完防火墙规则后,需要重启防火墙服务使其...

    socket端口复用

    这里的“更明确”通常指的是绑定的具体IP地址,即如果两个服务都绑定到了相同的端口号,但是指定了不同的IP地址,那么特定IP地址的数据包将会被定向到那个指定了该IP的服务。 #### 二、端口复用在C#中的实现 在C#...

    远程桌面端口端口修改工具

    另外两个URL文件——护卫神-服务器安全专家.url和比克尔.url,看起来是与服务器安全相关的网站链接。这些链接可能提供了更多关于服务器安全的信息,包括但不限于如何更安全地配置远程桌面,以及其他的系统安全策略。...

    中兴2826s交换机端口隔离

    这些命令设置了每个端口的默认VLAN ID(PVID),当端口接收到没有携带VLAN标签的数据包时,会自动将该数据包打上对应的PVID作为VLAN标签。 3. **设置VLAN的FID(过滤标识符):** ```bash zte(cfg)#set vlan 2-4,...

    win7旗舰版系统下开启计算机端口的两个方法.docx

    如果你想开启一个端口,如80,就添加一条规则,指定TCP协议,本地IP地址为所有(0.0.0.0),远程IP地址也为所有,端口范围设定为80。完成后点击“确定”以保存设置。 **查看端口开启情况** 除了手动开启端口,还...

    s3500系列交换机端口隔离配置

    - **端口聚合与端口隔离**:这两个特性不兼容,不能在同一个端口上同时配置。 - **适用范围**:上述配置方法不仅适用于S3500系列交换机,也适用于Quidway S2000-EI系列交换机。 通过这些配置,网络管理员可以更有效...

    简单好用的端口映射器

    3. **设定协议类型**:端口映射支持TCP和UDP两种传输协议。TCP用于大多数基于连接的服务,如HTTP、HTTPS和FTP;UDP则常用于无连接的服务,如DNS查询和在线游戏。 4. **启用映射**:设置完成后,启用端口映射,软件...

    开启与关闭计算机端口

    例如,如果你想开启80端口(HTTP服务)和3389端口(远程桌面服务),则在“TCP端口”栏中点击“添加”,分别输入这两个端口号,然后点击“确定”。 开启和关闭端口可以提高系统的安全性。例如,关闭不使用的端口...

    moss的文档转换负载平衡器服务占用80端口问题

    标题中的“moss的文档转换负载平衡器服务占用80端口问题”指的是在SharePoint 2007环境中,Microsoft Office SharePoint Server (MOSS) 的一个特定组件——文档转换负载平衡器服务(Microsoft.Office.Server....

    交换机端口汇聚配置

    这里主要分为两个部分:SwitchA的配置和SwitchB的配置。两者的配置过程基本相似,下面以SwitchA为例进行说明。 1. **进入端口E0/1**: - 命令行操作:`[SwitchA]interface Ethernet0/1` 2. **设置端口为全双工模式...

Global site tag (gtag.js) - Google Analytics