Apache2.2.x+tomcat single IP multiple domain name multi-site Virtual host configuration detailed (Win2003 environment)

Source: Internet
Author: User
Tags tomcat server

apache2.2.x+tomcat single IP multiple domain name multi-site Virtual host configuration detailed (Win2003 environment)

A new server was recently purchased, and the apache+tomcat+php Web application environment was successfully consolidated under WINDOWS2003. The next encounter is through the server under the single IP configuration of multiple sites and multiple domain name problems.

First, where the prior Google or Baidu, find a lot of relevant articles, through analysis and their own to try to figure out, finally configured successfully, the entire configuration process is recorded, I hope to help.

First, domain name resolution
resolves all the domain names to be configured to this IP address on the server.
Here I parse over the domain name has 4: www.czworld.cn czworld.cn www.17jfz.com 17jfz.com
Resolution, the effective time by the DNS decision of the domain name, short 1-2 minutes, 24 hours long.


Two, configure the httpd.conf file
1. With Notepad to open the apache  directory conf/httpd.conf file, find the following module
# Virtual Hosts
#Include conf/extra/httpd-vhosts.conf

2. Remove the # in front of the second line, which opens the Httpd-vhosts virtual host file for the purpose of configuring the virtual host.


Three, configure the httpd-vhosts.conf file
1. Open apache  directory with Notepad conf/extra/ The httpd-vhosts.conf file is configured as follows:
Namevirtualhost *:80
<virtualhost *:80>
    ServerAdmin ziqiang4917@163.com
    documentroot d:/www/czworld
    ServerName www.czword.cn
    Serveralias czword.cn

<directory d:/www/czworld>
Options Indexes FollowSymLinks
AllowOverride None
Order Allow,deny
Allow from all
</Directory>
</VirtualHost>

<virtualhost *:80>
ServerAdmin ziqiang4917@163.com
DocumentRoot D:/WWW/17JFZ
ServerName www.17jfz.com
Serveralias 17jfz.com

<directory d:/www/czworld>
Options Indexes FollowSymLinks
AllowOverride None
Order Allow,deny
Allow from all
</Directory>
</VirtualHost>

Detailed Description:
#ServerAdmin Service Email, just write your own mailbox.
Directory path for #DocumentRoot Web site
#ServerName the primary domain name of the site
#ServerAlias the domain name of the site
#Directory Configure access to the Site directory path, remember to allow from all


Iv. Modify the Hosts file under c:/windows/system32/drivers/etc/:
1. Open the Hosts file, add the following configuration
127.0.0.1 czworld.cn
127.0.0.1 www.czworld.cn
127.0.0.1 17jfz.com
127.0.0.1 www.17jfz.com
(Note: This step is not required if you do not need a local development test to set this up)


iv. Configure Tomcat server.xml files:
1. Open the Conf/server.xml file under the Tomcat directory, wrap the line after <!--Czworld begin-->
<Alias>www.czworld.cn</Alias>
<context path= "" docbase= "D:/www/czworld" reloadable= "true" crosscontext= "true" >
<WatchedSource>WEB-INF/web.xml</WatchedSource>
</Context>
</Host>
<!--Czworld End-->

<!--17JFZ begin-->
<Alias>www.17jfz.com</Alias>
<context path= "" docbase= "D:/www/17jfz" reloadable= "true" crosscontext= "true" >
<WatchedSource>WEB-INF/web.xml</WatchedSource>
</Context>
</Host>
<!--17JFZ End-->


Restart Apache and Tomcat service, enter your URL in the address bar, haha, successful!
(Note: You must be a successful domain name resolution before you can access the Web site correctly)

Http://www.cnblogs.com/ziqiang4917/archive/2009/09/11/1564458.html

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.