tomcat部署不同端口号的项目,多个ROOT文件夹的配置方式(理论上兼容至tomcat5-tomcat9)

  • 修改tomcat下的conserver.xml文件
配置service 节点,你有几个项目,就相应的配置几个service 节点



OK,复制完成之后就可以把其他tomcat 下的应用复制过来改改webapp的名字,启动一下试试了!
懒人模板:(这里是两个项目的配置,不要无脑复制哦,哈哈哈)
<Service name="Catalina1">
     <Connector port="8081" protocol="HTTP/1.1"
	   connectionTimeout="20000"  
	   maxHttpHeaderSize="998192"
	   URIEncoding="UTF-8"
	   compression="on" 
	   compressionMinSize="2048" 
	   noCompressionUserAgents="gozilla, traviata"
	   compressableMimeType="text/html,text/xml,text/css,text/javascript"
	 />
  
    <Engine name="Catalina" defaultHost="localhost">

      <Realm className="org.apache.catalina.realm.LockOutRealm">
        <!-- 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"/>
      </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 "%r" %s %b" />

      </Host>
    </Engine>
  </Service>
<Service name="Catalina2">
     <Connector port="8082" protocol="HTTP/1.1"
	   connectionTimeout="20000"  
	   maxHttpHeaderSize="998192"
	   URIEncoding="UTF-8"
	   compression="on" 
	   compressionMinSize="2048" 
	   noCompressionUserAgents="gozilla, traviata"
	   compressableMimeType="text/html,text/xml,text/css,text/javascript"
	 />
  
    <Engine name="Catalina" defaultHost="localhost">

      <Realm className="org.apache.catalina.realm.LockOutRealm">
        <!-- 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"/>
      </Realm>

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

        <Valve className="org.apache.catalina.valves.AccessLogValve" directory="logs"
               prefix="localhost_access_log" suffix=".txt"
               pattern="%h %l %u %t "%r" %s %b" />

      </Host>
    </Engine>
  </Service>







  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
对于部署多模块项目Tomcat,有几个步骤需要遵循。首先,你需要对总的项目root)进行打包,而不是单独对某一个模块进行打包。这是因为很多模块可能依赖于其他模块,所以需要对整个项目进行打包。\[2\]其次,你需要配置项目的依赖关系。如果你的项目拆分成多个模块,你可以将这些模块作为子项目添加到主项目中。\[3\]然后,你需要在动态Web项目的属性设置中配置部署组件,将子项目添加到Web项目中。\[3\]最后,你可以将动态Web项目导出为WAR包,并将其放置在Tomcat的webapps目录下。启动Tomcat后,项目将自动解压并运行。\[3\]请注意,你可以通过修改Tomcat配置文件server.xml来更改Tomcat端口号。\[3\] #### 引用[.reference_title] - *1* *3* [多模块javaweb项目构建tomcat部署](https://blog.csdn.net/weixin_30897079/article/details/98082504)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v91^insert_down1,239^v3^insert_chatgpt"}} ] [.reference_item] - *2* [本地Tomcat如何部署多端口多模块项目](https://blog.csdn.net/w524254582/article/details/117473170)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v91^insert_down1,239^v3^insert_chatgpt"}} ] [.reference_item] [ .reference_list ]
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值