Tomcat server.xml label detailed __tomcat

Source: Internet
Author: User
Tags java web tomcat server

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 ...


Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.