1、必须通过域名+端口号才能访问
最初用的8080端口,改为80端口后直接通过域名访问
server.xml 中<Connector port="80" protocol="HTTP/1.1" connectionTimeout="20000" redirectPort="8443" />即可
2、此处这样配置可确保该域名直接对应该项目主页
<Host name="localhost" appBase="webapps"
unpackWARs="true" autoDeploy="true">
<!-- SingleSignOn valve, share authentication between web applications
Documentation at: /docs/config/valve.html -->
<!--
<Valve className="org.apache.catalina.authenticator.SingleSignOn" />
-->
<Context path="" docBase="C:/apache-tomcat-7/webapps/项目名" reloadable="false" crossContext="true"/>
<!-- Access log processes all example.
Documentation at: /docs/config/valve.html
Note: The pattern used is equivalent to using pattern="common" -->
<Valve className="org.apache.catalina.valves.AccessLogValve" directory="logs"
prefix="localhost_access_log." suffix=".txt"
pattern="%h %l %u %t "%r" %s %b" />
</Host>
3、服务器端口开启
1)服务器设置
命令行 netsh firewall add portopening TCP 80 MyWebPort
2)阿里云 处设置
来源:CSDN
作者:静水流深LY
链接:https://blog.csdn.net/dota51888/article/details/73498034