注意:我這裡的wampserver版本是2.5
在 h:\wampserver\wamp\bin\apache\apache2.4.9\conf\httpd.conf 裡面開啟三個配置項。將前面的#取消即可。
loadmodule rewrite_module modules/mod_rewrite.so
loadmodule vhost_alias_module modules/mod_vhost_alias.so
include conf/extra/httpd-vhosts.conf
在 h:\wampserver\wamp\bin\apache\apache2.4.9\conf\extra\httpd-vhosts.conf 裡新增虛擬主機
serveradmin [email protected]
documentroot "c:/apache24/docs/dummy-host.example.com"
servername dummy-host.example.com
serveralias www.dummy-host.example.com
errorlog "logs/dummy-host.example.com-error.log"
customlog "logs/dummy-host.example.com-access.log" common
#這是原檔案的,根據原始檔新增配置虛擬主機
serveradmin [email protected]
documentroot "h:/wampserver/wamp/www/tp5/public"
servername www.stu01.com
serveralias www.stu01.com
errorlog "logs/dummy-host.example.com-error.log"
customlog "logs/dummy-host.example.com-access.log" common
在c:\windows\system32\drivers\etc\hosts 解析 127.0.0.1
127.0.0.1 localhost
127.0.0.1 www.stu01.com
重啟wampserver即可
方法二是直接在h:\wampserver\wamp\bin\apache\apache2.4.9\conf\httpd.conf 裡直接配置虛擬網域名稱在檔案末端新增以下**
serveradmin [url=mailto:[email protected]][email protected][/url]
documentroot h:/wampserver/wamp/www/tp5/public
servername www.stu01.com
#serveralias www.stu01.com
options indexes followsymlinks
allowoverride all
errorlog "logs/www.stu01.com-error.log"
customlog "logs/www.stu01.com-access.log" common
# wamp配置虛擬網域名稱方法一
使用了方法一後我們可能會發現localhost反而不能訪問了
解決方法:在 h:\wampserver\wamp\bin\apache\apache2.4.9\conf\extra\httpd-vhosts.conf 裡再新增乙個localhost的配置項
serveradmin [email protected]
documentroot "h:/wampserver/wamp/www"
servername localhost
serveralias localhost
errorlog "logs/dummy-host.example.com-error.log"
customlog "logs/dummy-host.example.com-access.log" common
wamp虛擬主機配置
今天學習zend framework 順便學習了一下配置虛擬主機,記錄一下 1 首先 開啟apache的配置檔案httpd.conf,並去掉 include conf extra httpd vhosts.conf前面的 啟用虛擬主機功能 2 先把localhost配置好,免得以後訪問localho...
wamp虛擬主機配置
1 首先開啟apache的配置檔案httpd.conf,並去掉 include conf extra httpd vhosts.conf前面的 啟用虛擬主機功能 2 先把localhost配置好,免得以後訪問localhost出現問題,我的wamp專案根目錄是d wamp www。將下面資訊新增到a...
wamp配置虛擬主機
1.開啟apache的配置檔案httpd.conf,並去掉 include conf extra httpd vhosts.conf前面的 來啟用虛擬主機功能 2.找到apache的配置檔案httpd vhosts.conf 我的wamp裝在f盤下 f wamp bin apache apache2...