Get a period of Web project (based on JSP JavaBean technology, the server is Apache Tomcat) found that our project files are placed in Tomcat_Home \WebApps, although we can configure our project to other directories via Server.xml, but when When the project is more, the server.xml will become bloated, and the confusion is unable to manage and maintain. In order to avoid the above cases, it will be more convenient for the project to be more convenient to manipulate, including one or two virtual hosts that only configure one or two virtual hosts in Server.xml to solve the centralized management of the project, and the configuration files required for each project are also You don't have to add it to Server.xml, so that Server.xml is no longer bloated, not chaotic, but more to manage and maintain. I have said that I have already jumped to try it for a long time, then I will not hurry with me, what are you waiting for! (^_^)
First, prepare: Suppose you are already a web programmer, and you have a certain understanding of Tomcat, and you can regularly configure it.
Second, start configuration: 1.) First find the server.xml file in the tomcat_home / conf directory and open it in the Notepad; 2,) Find Host> tag in the file server.xml; 3,) in The following information is created after the Host> label:
Host> Description: [Onion] for your host name or domain name; [f: / studioonion / web_project] is the starting directory of the virtual host; [onion_log] is the log file name; [Onion_access_log] is the log of the host file name. 4, in the start directory of the virtual host, build a directory and a configuration file with the project with the project (my F: / Studioonion / Web_Project / SHSC / and F: / STUDIONONON / Web_Project / SHSC.XML ). 5.) Open the basic information that has just been built to configure the basic information of your project (such as virtual directory and real path, etc.), in short, almost all configurations can be completed in this configuration file, of course, servlet and bean deployment To do it in web.xml, this article does not involve this so that this will not be described here. Below is the content in my profile SHSC.XML is for reference only: