同一个tomcat,不同端口启动各自程序

  1. 安装目录下找到server.xml
  2. 编辑server的子标签,添加一个service标签
<Service name="Catalina">

    <Connector connectionTimeout="20000" port="8081" protocol="HTTP/1.1" redirectPort="8543"/>

    
    <Connector port="8109" protocol="AJP/1.3" redirectPort="8543"/>

    <Engine defaultHost="localhost" name="Catalina">

      <Realm className="org.apache.catalina.realm.LockOutRealm">
        <Realm className="org.apache.catalina.realm.UserDatabaseRealm" resourceName="UserDatabase"/>
      Realm>

      <Host appBase="webapps" autoDeploy="true" name="localhost" unpackWARs="true">

        <Valve className="org.apache.catalina.valves.AccessLogValve" directory="logs" pattern="%h %l %u %t "%r" %s %b" prefix="localhost_access_log" suffix=".txt"/>
        <Context path="/route" reloadable="true" docBase="D:\Program Files\apache-tomcat-8.0.28\程序xxxx"/>  
      Host>
    Engine>
  Service>
  1. 其值为上述代码
    注意:两个Connector 标签的 port 和redirectPort的值。
<Connector connectionTimeout="20000" port="**8081**" protocol="HTTP/1.1" redirectPort="8543"/>
<Connector port="8109" protocol="AJP/1.3" redirectPort="8543"/>

Host中添加:

docBase:为项目目录


相同端口不同程序,则直接将war包,扔到webapps中即可。

你可能感兴趣的:(安装)