Tomcat7去除端口号和项目名称
TOMCAT_HOME:为Tomcat的安装路径(解压版Tomcat的所在路径)。
编辑TOMCAT_HOME/conf/server.xml文件
1.去除端口号:即把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" />
2.去除项目名称:
在server.xml中查找以下内容
?
<Host name="localhost" ?appBase="webapps"
? ? ? ? ? ? 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>
更改为:
<Host name="localhost" ?appBase="webapps"
? ? ? ? ? ? unpackWARs="true" autoDeploy="true">
<!--注释内容已删除-->
<!--添加以下内容 projectName是你项目的名称 -->
<Context docBase="projectName?" path="" debug="0" reloadable="false" />
? ? ? ? <Valve className="org.apache.catalina.valves.AccessLogValve" directory="logs"
? ? ? ? ? ? ? ?prefix="localhost_access_log." suffix=".txt"
? ? ? ? ? ? ? ?pattern="%h %l %u %t "%r" %s %b" />
</Host>
?
注明:以上内容已经测试通过
?