Tomcat Context configuration and Tomcat Context Configuration

Source: Internet
Author: User

Tomcat Context configuration and Tomcat Context Configuration
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 <Host>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.


Author: itmyhome



Context configuration in serverxml in tomcat

It is generally not used. This is a "virtual directory ". If your project is on disk D and your Tomcat is on another place, you can add this project when you don't want to put it on Tomcat. DocBase = "d:/xx .." is the location of your current project. Struts in path = "/struts" is the name of the folder you use when accessing the browser.

How to configure Tomcat context in MyEclipse

You do not need to configure this tamcat. You have a user name and password. Go to C: \ Program Files \ Tomcat 6.0 \ conf. This is my installation path, you find the tomcat-users.xml file under this path to see what is the user name and password, open the home page Click tomcat manager enter the user name and password

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.