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 為域名