您的位置:首页 > 运维架构 > Tomcat

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

2018-01-26 20:40 429 查看
修改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>
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
相关文章推荐