Virtual Host configuration method in tomcat5.x

Source: Internet
Author: User
Tags log tomcat
Virtual Host Author: Wang Shuli

Original by:
For a while the Web project (based on Jsp+javabean technology, server-APACHE+TOMCAT) found that our project files were in Tomcat_home\webapps, Although we can configure our projects to other directories through Server.xml, the server.xml will become bloated and unwieldy when more projects are available, and difficult to manage and maintain.
In order to avoid the above situation, For the project to be more manageable the next step is to configure one or two virtual hosts in Server.xml to resolve centralized management of the project, and the configuration files needed for each project need not be added to the server.xml, making server.xml no longer bloated, Not in the chaos, but more conducive to management and maintenance.
Said for a long time you must have been eager to, it is not quick to come with me, but also what it! (^_^)

First, Prepare:
Suppose you are already a web programmer and have some knowledge of tomcat, and you can configure it routinely

Second, start the configuration:
1. First find the Server.xml file in the tomcat_homeconf directory and open it in Notepad;
2. Find </Host> label in document Server.xml;
3. After </Host> tag, create the following information:

<logger classname= "Org.apache.catalina.logger.FileLogger" directory= "Logs" prefix= "Onion_log". "suffix=". txt Timestamp= "true"/>
<valve classname= "Org.apache.catalina.valves.AccessLogValve" directory= "Logs" prefix= "onion_access_log." Suffix = ". txt" pattern= "common" resolvehosts= "false"/>

</Host>
Description
"Onion" for the name of your host or domain;
"F:studioonionweb_project" is the starting directory of the virtual host;
"Onion_log" is the log file name;
"Onion_access_log" is the log file name for the access host.
4. Create a directory for your project and a configuration file with the same name as the project (mine is F:studioonionweb_project SHSC and F:studioonionweb_project Shsc.xml) in the starting directory of the virtual host.
5. Open the newly-built project profile to configure your project's basic information (such as virtual directories and real-world paths, etc.), in short, almost all configurations can be completed in this configuration file, Of course the deployment of the servlet and Bean is done in web.xml, and this is not covered in this article. The following are the contents of my profile shsc.xml for informational purposes only:
<context path= "" docbase= "F:STUDIOONIONWEB_PROJECTSHSC" debug= "0" reloadable= "true" crosscontext= "true" >
</Context>

Third, testing
Open IE in the address bar input HTTP://ONION/SHSC If you see your JSP page, congratulations on your success; if not, hehe haha???????????? Let's go over it Again (^_^).

Iv. Thank you.
Thanks to the Apache organization for providing me with such a good server, and it's free!

V. Description
If you feel satisfied, want to reprint or collect this article, I am very grateful, but please note the author: Wang Shuli (^_^)



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.