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)