tomcat配置多端口访问
应用场景:
操作方法
- 01
在tomcat的conf/server.xml中,配置多个端口,如下: <?xml version="1.0"?> <!--应用1,端口port="8080"--> <Service name="Catalina"> <Connector connectionTimeout="20000" port="8080"protocol="HTTP/1.1" redirectPort="8443" /> <Connector port="8009" protocol="AJP/1.3" redirectPort="8443" /> <Engine defaultHost="localhost" name="Catalina"> <Host appBase="webapps" autoDeploy="true" name="localhost" unpackWARs="true" xmlNamespaceAware="false" xmlValidation="false"> <Context path="" docBase="D:\root\项目1根路径\" reloadable="true" workDir="D:\whtjroot\项目1根路径\work" /> </Host> </Engine> </Service> <!--应用2,端口port="8090"--> <Service name="Catalina2"> <Connector connectionTimeout="20000" port="8090"protocol="HTTP/1.1" redirectPort="8443" /> <Connector port="8009" protocol="AJP/1.3" redirectPort="8443" /> <Engine defaultHost="localhost" name="Catalina2"> <Host appBase="webapps" autoDeploy="true" name="localhost" unpackWARs="true" xmlNamespaceAware="false" xmlValidation="false"> <Context path="" docBase="D:\root\项目2根路径\" reloadable="true" workDir="D:\whtjroot\项目2根路径\work" /> </Host> </Engine> </Service>
- 02
在服务器中开设端口 控制面板 —> 防火墙 —> 高级设置 —> 入站规则 —> 新建规则 —> 端口 —> 填写开放的端口号