Tomcat starts the default access project

There are generally two kinds of implementations that can be implemented: this one is recommended, and it is more flexible.

The compiled projects of general projects are all under Tomcat's webapps, and the access path of the project is generally: http://localhost:8080/project virtual path. However, the default access page of Tomcat http://localhost:8080 accesses the page with cats in Tomcat. If you want to directly enter the local address http://localhost:8080, you can get the default access page of the project, and perform the following configuration :

After Tomcat is installed, the default directory of tomcat is the webapps/root directory. If you want to change the default access directory, that is:
after opening the location where Tomcat is installed, find this line in conf/server.xml under Tomcat:

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

Add it in the middle of <Host …></Host> ( pay attention to the case of the project name, the default is all lowercase, because the project name in web.xml is set to be all lowercase by default )

<Context docBase="[project name here]" path="" debug="0" reloadable="true" />
 
E.g:
<Context path="" docBase="myPojectTest" debug="0" reloadable="true"/>
In this way, you can directly access the myPojectTest project under webapps through http://localhost.

Guess you like

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