Configuration of context in Tomcat

Source: Internet
Author: User
Tomcat direct IP address access without adding a port or project name

After we develop a web project and deploy it to Tomcat, we should normally access: http: // localhost: Port Number/Project Name

If we want users to only enter the domain name to access our project, we need to modify the context settings of Tomcat.

Modify{Tomcat_home}/CONF/server. xmlFile

Open the server. xml file in the text editor.<Host>Add under Node<Context>Node, and setPath, docbase, reloadableAttribute

<Host name="localhost"  appBase="webapps"            unpackWARs="true" autoDeploy="true"            xmlValidation="false" xmlNamespaceAware="false">  <Context path="/" docBase="/projectName" reloadable="false"/>       </Host>

<Context> attributes of an element:

Path: Specifies the URL entry to access the Web application. Path = "/" or Path = ""

Docbase: Specifies the file path of the Web application.Absolute pathYou can also specify the appbase attribute relative to the Relative Path,

If the web application adopts an open directory structure, specify the root directory of the Web application. If the web application is a war file, specify the path of the war file.

This can be the relative path: docbase = "/projectname" or absolute path: docbase = "D: \ Tomcat \ webapps \ projectname"

Reloadable: If this property is set to true, the Tomcat server will monitor changes to the class files in the WEB-INF/classes and WEB-INF/lib directories while running,

If a class file is detected to be modified, the server automatically reloads the web application.


Itmyhome


Configuration of context in Tomcat

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.