Wamp安裝問題:#Includeconf/extra/httpd-vhosts.conf 去掉#無法訪問問題
一直在用Qampp或者phpstudy,因公司需要換了wamp(wamp2.5),
發現在 D:\wamp\bin\apache\apache2.4.9\conf\httpd.conf 裡面
#Includeconf/extra/httpd-vhosts.conf 去掉#無法訪問localhost,報403錯誤。
在網上看很多教程是在這個目錄下搜尋到
<Directory />
AllowOverride none
Require all denied
</Directory>
把denied 改成 granted
我的解決方法是:
開啟D:\wamp\bin\apache\apache2.4.9\conf\extra\ httpd-vhosts檔案,配置好localhost虛擬主機,參照httpd-vhosts檔案中例項,修改成如下:
<VirtualHost *:80>
ServerAdmin [email protected]
DocumentRoot "D:\wamp\www"
ServerName localhost
ErrorLog "logs/dummy-host2.example.com-error.log"
CustomLog "logs/dummy-host2.example.com-access.log" common
</VirtualHost>
修改配置如下:
DocumentRoot修改為本地wamp環境下的www目錄(如:D:\wamp\www)
ServerName改為localhost
然後訪問localhost問題解決了,感謝 CSDN可克技術的部落格幫我解決問題;
我新增的域名:
<VirtualHost *:80>
ServerAdmin [email protected]
DocumentRoot "D:\web"
ServerName www.web.com
ServerAlias www.web.com
<Directory "D:/web">
Options Indexes FollowSymLinks
AllowOverride All
Require all granted
</Directory>
ErrorLog "logs/dummy-host2.example.com-error.log"
CustomLog "logs/dummy-host2.example.com-access.log" common
</VirtualHost>