Tomcat多域名、多端口

Tomcat主要通过编辑server.xml文件来实现多端口多域名:

[参考:]

http://www.cnblogs.com/fengyefeiluo/p/5076231.html

http://blog.csdn.net/chenhui1219/article/details/6046925

1.多端口,添加标签Connector ,如:

<Connector port="8080" protocol="HTTP/1.1"
connectionTimeout="20000"
redirectPort="8443" />

<Connector port="9090" protocol="HTTP/1.1"
connectionTimeout="20000"
redirectPort="8443" />

2.多域名,添加标签Host 。注意 appBase=”webapps”也修改

<Host name="twig.studio" appBase="/www/webs/unwi/"
unpackWARs="true" autoDeploy="true">
<Context path="/" docBase="/www/webs/unwi/"/>
</Host>
<Host name="codehut.studio" appBase="/www/webs/unwi/codehut/"
unpackWARs="true" autoDeploy="true">
<Context path="/" docBase="/www/webs/unwi/codehut/"/>
</Host>

3.二级域名,Host标签下添加标签Alias

<Host name="unwi.net" debug="0" appBase="webapps"
unpackWARs="true" autoDeploy="true" xmlValidation="false" xmlNamespaceAware="false">
<Alias>codehut.unwi.net</Alias>
<Alias>twig.unwi.net</Alias>
<Context path="/" docBase="d:/wwwroot/chengqun"></Context>
</Host>

4.不同端口,不同域名,添加Service标签,如

<Service name="Catalina">
...
</Service>
<Service name="Catalina1">
...
</Service>

One Comment

Add a Comment

电子邮件地址不会被公开。 必填项已用*标注