主要配置tomcat/conf目录下的server.xml文件

1、先找到8080端口,把端口改为80。

<!-- A "Connector" represents an endpoint by which requests are received  
       and responses are returned. Documentation at :  
       Java HTTP Connector: /docs/config/http.html (blocking & non-blocking)  
       Java AJP  Connector: /docs/config/ajp.html  
       APR (HTTP/AJP) Connector: /docs/apr.html  
       Define a non-SSL HTTP/1.1 Connector on port 8080  
  -->  
  <Connector port="80" protocol="HTTP/1.1"  
             connectionTimeout="20000"  
             redirectPort="8443" />  
  <!-- A "Connector" using the shared thread pool-->

备注:设置Connector 节点的port="80"。

 

2、配置项目目录访问。

<Host name="localhost"  appBase="webapps/lotter"  
          unpackWARs="true" autoDeploy="true"  
          xmlValidation="false" xmlNamespaceAware="false">  
<Context path="" docBase="lottery" />  
<!--<Context path="/lottery" docBase="." /> -->



lottery”,webapps应用程序目录,这里我设置的是webapps/lottery的相对目录。项目绝对路径就是(D:/apache-tomcat-7.0.65/webapps/lottery)也就是tomcat下的webapps下的i18n部署的项目目录。

3、tomcat启动时项目重复加载两次

appBase="webapps"配置可有可无。将项目lottery放在webapps同一路径下

<Host name="localhost"  unpackWARs="true" autoDeploy="true"  
               xmlValidation="false" xmlNamespaceAware="false">
<Context path="" docBase="D:/apache-tomcat-7.0.65/lottery" debug="0" reloadable="true" />