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