Reference documents:
http://ewf-momo.iteye.com/blog/1707288 (Server.xml <Context/> detailed)
http://18818053618.blog.51cto.com/8354811/1434545 (Tomcat <context path= "docbase=" "/>)
Http://blog.knowsky.com/206846.htm (Tomcat configuration virtual Directory--<context> label)
In a company project, two projects in a Tomcat deployment, one deployed under Webaspps, one deployed to root, a project wanted to access directly through domain names. Starting Tomcat caused a memory overflow problem. A great God. By configuring the <context> tag under Tomcat's server.xml, adding a virtual path solves this problem temporarily because we are reconfiguring the access path (but we can only run through another project and the problem is not resolved). But after learning <context> labels, here's a summary.
Configuration of the context in Tomcat
After we have developed a Web application, we need to publish the application to webserver so that other users can access it. In the field of Java Web Development, we typically use Tomcat as our web server for testing or formal deployment.
Typically, we package the Web application in the war format and then copy it to Tomcat's WebApps directory to publish it, under normal circumstances, Tomcat automatically extracts the war file and generates the corresponding directory, and dynamically creates the corresponding context path for the Web application in memory. For example, our war file is Test.war, then the extracted directory is the test directory, in memory dynamically created by the context path is/test. The default behavior in the development phase is acceptable, but in the case of a formal deployment, we usually need to modify the application's context path to suit our needs.
If we want users to simply enter the domain name to access our sample application, we need to modify the Tomcat settings. There are two ways to set up a context path, one is to modify the {Tomcat_home}/conf/server.xml file, and the other is to create a context fragment file in the WebApps directory. We introduce the first approach here.
Open the Server.xml file with any text editor, add <Context> nodes under the <Host> node, and set the Path,docbase,debug and Reloadable properties as follows:
<context path= "" docbase= ""/>
not finished editing ...