1. 打 Apacheconfhttpd.conf 文件,搜索 「Include
conf/extra/httpd-vhosts.conf」,確保 Include conf/extra/httpd-vhosts.conf 前面沒有
# 註釋符,也就是確保引入了 vhosts 虛擬主機配置文件。
在虛擬主機設置文 extrahttpd-vhosts.conf 裏設置:
取消 NameVirtualHost *:80 前面的 ##,這樣就啓用了 vhosts.conf ,默認的 httpd.conf 默認配置失效。虛擬主機配置將只設置在 httpd-vhosts.conf 裏。
在 Apacheconfextrahttpd-vhosts.conf 這個文件裏面的最後面添加以下代碼 (C:ComsenzEXPwwwrootww
) 這個是你的網站目錄地址,www.weixiaoduo.com 這個是你要綁定的域名。

<VirtualHost 127.0.0.1:80>
DocumentRoot D:ComsenzEXPwwwroot
ServerName www.weixiaoduo.com
ServerAlias *
DirectoryIndex index.htm index.php index.html
ErrorLog "logs/test-error_log"
CustomLog "logs/test.log" common
</VirtualHost>

<VirtualHost 127.0.0.2:80>
DocumentRoot D:ComsenzEXPwww
ServerName weixiaoduo.com
ServerAlias *
DirectoryIndex index.htm index.php index.html
ErrorLog "logs/test-error_log"
CustomLog "logs/test.log" common
</VirtualHost>

注:DocumentRoot D:ComsenzEXPwwwroot 為網站地址
       ServerName weixiaoduo.com 為域名