Reasons:
Engage in a period of WEB projects (based on JSP + JavaBean technology, the server is Apache + Tomcat) found that our project files are placed in the TOMCAT_HOMEwebapps in, though you can configure server.xml our project to other directory, but when many items When the server.xml will become its bloated and messy; difficult to manage and maintain.
To avoid the above situation does not occur, in order to project more manageable the next will tell you is that only one or two in the server.xml to configure virtual hosts to address the project's centralized management, and configuration files needed for each project are also do not add it to the server.xml in making server.xml not bloated, not confusion, but more conducive to manage and maintain.
First, to prepare:
Suppose you have a web programmer, and have some understanding of the tomcat, and can configure their routine
Second, start the configuration:
1) First of all, in the TOMCAT_HOME the server.xml file found in conf directory and open it in Notepad;
2) find the tag in the file server.xml;
3) Host> tag after the new information below:
unpackWARs = "true" autoDeploy = "true">
prefix = "onion_log." suffix = ". txt" timestamp = "true" />
prefix = "onion_access_log." suffix = ". txt" pattern = "common" resolveHosts = "false" />
Description:
】 【Onion the name of your host or domain name;
【F: StudioOnionWEB_Project】 starting directory for the virtual host;
【Onion_log】 for the log file name;
】 【Onion_access_log host for the visit to the log file name.
4) Start the virtual host directory for your project to build a directory and a project with the same name of the configuration file (mine is f: StudioOnionWEB_Project shsc and f: StudioOnionWEB_Project shsc.xml).
5) Open the project that has just built your project configuration file to configure the basic information (such as: virtual directory and real path, etc.), in short almost all of the configuration can be completed in this configuration file, of course, to the deployment servlet, and bean In web.xml, to complete, this is not related to this content does not go into it here. The following is the contents of the configuration file shsc.xml reference:
reloadable = "true" crossContext = "true">
Third, test
Open IE in the address bar http://onion/shsc if your jsp page to see, Congratulations on your success.