1.修改hosts文件 路径 C:\Windows\System32\drivers\etc\hosts
# localhost name resolution is handled within DNS itself.# 127.0.0.1 localhost# ::1 localhost 192.168.1.10 www.myweb.com //填写你的ip地址和域名
2. 去除端口号:即把Tomcat的监听端口该为80,在访问项目时就可以不写端口号
在server.xml中查找以下内容
<Connector port="8080" protocol="HTTP/1.1"
connectionTimeout="20000"
redirectPort="8443" />
更改为:
<Connector port="80" protocol="HTTP/1.1"
connectionTimeout="20000"
redirectPort="8443" />
3. 去除项目名称
在server.xml中查找以下内容
<Host name="localhost" appBase="webapps" unpackWARs="true" autoDeploy="true" xmlValidation="false" xmlNamespaceAware="false">
改为:
<Host name="192.168.1.10 " appBase="webapps" unpackWARs="true" autoDeploy="true" xmlValidation="false" xmlNamespaceAware="false">
<!--添加以下内容 projectName是你项目的名称 -->
<Context docBase=" projectName " path="" debug="0" reloadable="false" />
转载于:https://www.cnblogs.com/Allen0603/archive/2013/03/05/2945103.html
相关资源:Tomcat与Java Web开发技术详解