Tomcat Configuration Virtual Directory mapping

Source: Internet
Author: User

This paper mainly introduces two common methods of Web virtual directory mapping and how to configure the default Web application.

First, the configuration in the Server.xml

Add child elements to the <Host> element <context path= "... "Docbase=" ... "/> and restart the server, path represents the virtual directory, Docbase represents the real Web application directory;

For example, in the C drive in the presence of a Web application, then <context path= "/test" docbase= "c:\a"/> The input http://localhost:8888/test/1.html will be able to access to the folder 1.html.

Note: This method requires a restart of the server to take effect, so it is not applicable, because each time you add a web app you need to restart the server.

Second, the best configuration method

$CATALINA _base/conf/catalina/localhost/folder to create an XML file, any file name can be, but this file name is the Web application after the publication of the virtual directory;

For example, create a test.xml, add <context docbase= "C:\a"/> In the file, do not need to restart the server, only need to enter http://localhost:8888/test/1.html in the browser to access C \ a\1.html;

Third, configure the default Web App

In general, you will jump out of the Tomcat home page after entering http://localhost:8080, because this Tomcat web app is the default Web app, and if you want to configure your Web app as the default Web app, just The <Context> element is <context path= "" docbase= "c:\a"/> or change test.xml to Root.xml; Enter HTTP://LOCALHOST:8080/1. HTML will be able to access C:\a\1.html;

This article transferred from: http://blog.csdn.net/xiazdong/article/details/7215052

Tomcat Configuration Virtual Directory mapping

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.