Web apps and virtual directory mappings

Source: Internet
Author: User

Tip:web applications

    • Web applications means browser-accessible programs, often referred to as Web applications.
    • A Web application consists of multiple static Web resources and dynamic Web resources, such as:
      • HTML, CSS, JS files
      • JSP files, Java programs, support jar packages
      • configuration files, etc...
      • These files that make up a web app typically use a directory organization, which is called the directory where the Web application resides .
    • After the Web application is developed, if you want to be accessible to the outside world, you need to give the Web application directory to the Web server management, which is called virtual directory mapping .

First, the implementation of the mapping of Web application virtual directory

Completing the virtual directory mapping for the Web application requires modifying the configuration file for the Tomcat server. Two methods are described below:

 Note: The two methods described below apply to the situation where the Web App directory is not in the WebApps directory of the tomcat server!!

    1. go to the Conf directory of the Tomcat server, open the Server.xml file, and add <context path on the </Host> tab = "/web app's external access directory (virtual directory)" docbase= "actual directory for Web App"/> Label, context stands for Web Apps!      note: After the configuration file is finished in this way, you must Restart the Tomcat server
    2. Enter the Tomcat server directory \conf\catalina\localhost, To create a new context file for your Web app, the file name represents your Web app's virtual directory, in this case I created a new Icast.xml context file in this directory, and when editing this file, note that you only need to add the Docbase attribute to the context tag , rather than adding the path attribute as in the Server.xml file, because the file itself represents the path (that is, the virtual directory).


Second, configure the default Web application

1. Configure the default Web App in the Server.xml file: simply set the Path property of the context tag to path= "";

2. Under the Tomcat server directory \conf\catalina\localhost directory, configuring the default Web App requires a new root.xml to overwrite the default Web App.

Third, tomcat6 or above to achieve automatic mapping

Configuring the context element in the Server.xml file is no longer recommended in TOMCAT6 or later versions.

The Tomcat server automatically manages all Web applications in the WebApps directory and maps it to a virtual directory, in other words, the Tomcat server WebApps the Web application in the directory, which can be accessed directly by the outside world.

Note: The automatic mapping assumes that you must place the Web app under the WebApps directory of the Tomcat server.

In the actual deployment, it is possible that the Web application and the server directory are not a drive letter, in which case you need to use the two methods described above (Configure the context element) to implement the mapping.

Web apps and virtual directory mappings

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.