Basic knowledge and common configuration of Tomcat

Source: Internet
Author: User

Basic knowledge and common configuration of Tomcat


Tomcat consists of:

Tomcat itself consists of a series of configurable components, the core component of which is the Servelt container component, which is the top-level container for all other Tomcat components.

Each component can be configured in the Tomcat installation directory/conf/server.xml file, and each Tomcat component corresponds to a configuration element in the Server.xml file.

The following two graphs describe the relationship of these components

================ Composition Structure 1=================



================ Composition Structure 2=================




The order in which the byte-code files are loaded in Tomcat:

Find bytecode files in the web-inf/classes of 1.WEB applications

Find the bytecode file in the jar file in the Web-inf/lib directory of the 2.Web app

3. Locate the bytecode file directly under Tomcat's LIB subdirectory

4. Find the bytecode file in the jar file in the Lib subdirectory of Tomcat



The configuration of the virtual host in Tomcat:

To configure a virtual host:

Configure <Host> tag in the Conf/server.xml <Engin> tab to add a virtual host to Tomcat

Name-Specifies the hostname of the virtual host to which the browser accesses the virtual host

AppBase--Virtual Host management directory, Web application placed in this directory the current virtual host can be loaded automatically

* default virtual host : If the visitor is accessed via IP, this time the server will not be able to identify which virtual host is currently accessing the resources, The default virtual host is accessed at this time. The default virtual host can be configured with the Defaulthost property on the Engin label in Server.xml.



Three common virtual path configurations for Tomcat

1. Configure <context path= "" docbase= ""/> in the <Host> tag in Tomcat's Server.xml file

Path: Virtual directory name, usually with/start

DocBase: Performing a real-world directory of native apps

If path is set to null this web app is the default Web App

This one is not recommended because the Tomcat server is restarted each time it is changed.


2. Configure a path.xml in the tomcat/conf/[engin]/[host]/directory, where path is the virtual path name

The XML is written in <context docbase= ""/>

If the configured virtual path is in the/because the file name is not allowed to include/need # override.

as long as the file name is set to Root.xml, this XML-described Web application becomes the default Web application


3. Put the Web application directly into the directory managed by the virtual host , the Web application can be found by the virtual host to manage this Web application

As long as you change the name of the Web App folder to root, this web app is the default Web app

Make a web app into a war package

Use the JAR-CVF War package name in the statistics directory of the app's Web-inf.


Basic knowledge and common configuration of 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.