Tomcat removes the project name and port number and directly uses the ip address to access the project

1. Problem description

In the process of website development, the general project access path is http://10.10.20.74:8080/how
to set projectName to http://10.10.20.74/

2. Solution

First, enter the conf directory under the installation directory of tomcat, my directory is /usr/local/apache-tomcat-6.0.20/conf, edit the file server.xml.

1. Remove the port number 8080
from the server.xml

 <Connector port="8080" protocol="HTTP/1.1"
        connectionTimeout="40000"
        redirectPort="8443"  
        enableLookups="false"  
        minProcessors="10" 
        maxProcessors="1024" 
        acceptCount="1024" />

change to

 <Connector port="80" protocol="HTTP/1.1"
        connectionTimeout="40000"
        redirectPort="8443"  
        enableLookups="false"  
        minProcessors="10" 
        maxProcessors="1024" 
        acceptCount="1024" />

That is, just change "8080" to "80" port.

2. Remove the project name projectName
in server.xml, add <Context path="" docBase="projectName" debug="0"/> between the tags of <host>...</host> and
empty work/catalina/ Download everything
Restart tomcat, enter http://10.10.20.74/ to access your project directly.

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=324973073&siteId=291194637