• 一个tomcat如何部署多个项目运行


    1.在根目录conf中修改server.xml文件。

    2.复制webapps。如两个项目,可为webapps和webapps1两个文件夹

     每个文件夹下放一个项目。在xml文件中配置两个端口,对应关系如一下代码参考

    <?xml version="1.0" encoding="UTF-8"?>
    
    <Server port="8005" shutdown="SHUTDOWN">
      <Listener className="org.apache.catalina.startup.VersionLoggerListener" />
    
      <Listener className="org.apache.catalina.core.AprLifecycleListener" SSLEngine="on" />
      
      <Listener className="org.apache.catalina.core.JreMemoryLeakPreventionListener" />
      <Listener className="org.apache.catalina.mbeans.GlobalResourcesLifecycleListener" />
      <Listener className="org.apache.catalina.core.ThreadLocalLeakPreventionListener" />
    
      
      <GlobalNamingResources>
        
        <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>
    
      
      <Service name="Catalina">
    
        
        <Connector port="8087" protocol="HTTP/1.1" connectionTimeout="20000"  redirectPort="8443" />  
        <Connector port="8009" protocol="AJP/1.3" redirectPort="8443" />
        
        <Engine name="Catalina" defaultHost="localhost">
          <Realm className="org.apache.catalina.realm.LockOutRealm">
           <Realm className="org.apache.catalina.realm.UserDatabaseRealm"  resourceName="UserDatabase"/>
          </Realm>
          <Host name="localhost"  appBase="webapps" unpackWARs="true" autoDeploy="true">
            <Valve className="org.apache.catalina.valves.AccessLogValve" directory="logs"
                   prefix="localhost_access_log" suffix=".txt"
                   pattern="%h %l %u %t &quot;%r&quot; %s %b" />
          </Host>
        </Engine>
      </Service>
      
      
    
      
      <!-- 第二个项目 -->
       <Service name="Catalina">
       <!-- 此端口为8089,其他项目端口不能有冲突 -->
         <Connector port="8089" protocol="HTTP/1.1"
                    connectionTimeout="20000"
                    redirectPort="8443" />
         <Connector port="8009" protocol="AJP/1.3" redirectPort="8443" />
         <Engine name="Catalina" defaultHost="localhost">
           <Realm className="org.apache.catalina.realm.LockOutRealm">
             <Realm className="org.apache.catalina.realm.UserDatabaseRealm"
                    resourceName="UserDatabase"/>
           </Realm>
           <Host name="localhost"  appBase="webapps1" unpackWARs="true" autoDeploy="true">
             <!-- 配置:项目名,项目路径 -->
                    
             <Valve className="org.apache.catalina.valves.AccessLogValve" directory="logs"
                    prefix="localhost_access_log." suffix=".txt"
                    pattern="%h %l %u %t &quot;%r&quot; %s %b" />
           </Host>
           <Valve className="org.apache.catalina.valves.RemoteIpValve" remoteIpHeader="X-Forwarded-For" 
                  protocolHeader="X-Forwarded-Proto" protocolHeaderHttpsValue="https" />
         </Engine>
       </Service>
    </Server>
    View Code
  • 相关阅读:
    截取小数位数(准确四舍五入及直接截取)
    水印
    用心整理的 献丑啦 一些关于http url qs fs ...模块的方法
    html禁止清除input文本输入缓存的两种方法
    flink写入elasticsearch报错!OOM内存溢出!连接异常关闭!
    实现网格建造系统
    AcWing 1064. 小国王
    AcWing 1052. 设计密码
    KMP 模板
    AcWing 1058. 股票买卖 V
  • 原文地址:https://www.cnblogs.com/chLxq/p/11062743.html
Copyright © 2020-2023  润新知