How to bind one IP address to multiple domain names (virtual hosts)

Source: Internet
Author: User

1. Create two domain name sites in advance

Separate the web1s and web2s, and separate the main pages web1.html and web2.html;

2. Enable httpd-vhosts.conf In the httpd. conf file

Remove #, that is

# Virtual hosts (virtual host) include CONF/extra/httpd-vhosts.conf

3. Set the http-vhosts.conf file (Path: X:/apachex. X/CONF/extra/http-vhosts.conf)

Add the following content:

# Configure the virtual host <virtualhost*: 80>DocumentRoot "D:/web1"Servername www.ayee1.com# Configure directoryindex on the welcome HomepageWeb1.htmlIndex.html index.htm index. php <directory/> options followsymlinks # Do not allow others to modify the website page AllowOverride none # Set the access permission order allow, deny allow from all </directory> </virtualhost> # configure the virtual host <virtualhost*: 80>DocumentRoot "D:/web2"Servername www.ayee2.com# Configure directoryindex on the welcome HomepageWeb2.htmlIndex.html index.htm index. php <directory/> options followsymlinks # Do not allow others to modify the website page AllowOverride none # Set the access permission order allow, deny allow from all </directory> </virtualhost>

4. Add the IP ing between our IP address and host in the hosts file (Path: C:/Windows/system32/Drivers/etc/hosts)

Add the following address under 127.0.0.1 localhost:

127.0.0.1    www.ayee1.com127.0.0.1    www.ayee2.com

Configuration complete.

Now you can access two domain names (www.ayee1.com and www.ayee2.com) under the same IP address.

How to bind one IP address to multiple domain names (virtual hosts)

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.