Deploy the project on tomcat to access without adding the project name

Problem: When deploying a project on tomcat, you need to add the project name to access it, but there is no project name on the request, so it will cause a request 404

solve:

Modify server.xml in the conf folder under tomcat

<Host appBase="webapps" autoDeploy="true" name="localhost" unpackWARs="true">
        <Context path="" docBase="D\demo" reloadable="false" />
</Host>

docBase represents the absolute path of the project, you can also use a relative path, the project folder will be generated after jar and war are executed

Original address: https://www.jianshu.com/p/101fc24cd5d1

 

Guess you like

Origin www.cnblogs.com/HQ0422/p/12739998.html