Tomcat server runs hidden project name

Recently in the project, I encountered two project deployment problems, which are recorded as follows:

1. How to omit the project name when accessing the project deployed in tomcat, and only enter the ip and port number to access.

2. What is the difference between the project deployed in webapps and the project deployed in ROOT under webapps.

 

For question 1:

In the server.xml configuration file of tomcat, add a line of configuration to hide the project name.

<Host appBase="webapps" autoDeploy="true" name="localhost" unpackWARs="true">

        <Valve className="org.apache.catalina.valves.AccessLogValve" directory="logs" pattern="%h %l %u %t "%r" %s %b" prefix="localhost_access_log" suffix=".txt"/>

 

      <Context debug="0" docBase="/ResSys" path="" reloadable="true"/>    

</Host>

 

Inside the host, add the Context configuration, where docBase is the corresponding project path. After this configuration,

http://localhost:8080 and http://localhost:8080/ResSys/ will return the same page.

 

For question 2, after the successful startup of tomcat, enter http://localhost:8080/ to enter the welcome page of tomcat. These welcome pages are stored in ROOT.

 Therefore, if you want to modify the welcome page, you need to modify the configuration of conf/server.xml.

 

Guess you like

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