php設置Apache虛擬主機vhost
打開瀏覽器,提示“access forbidden! xampp 訪問目錄”
解決方法:
內容3 修改一下
<VirtualHost *:80>
ServerAdmin xxxxxx@qq.com
DocumentRoot "C:\website\guanwang"
ServerName www.abc.com
<Directory C:\website\guanwang>
Options Indexes FollowSymLinks Includes ExecCGI
AllowOverride All
Require all granted
</Directory>
ErrorLog "logs/dummy-host2.www.abc.com-error.log"
CustomLog "logs/dummy-host2.www.abc.com-access.log" common
</VirtualHost>
轉載:http://blog.csdn.net/oneym/article/details/48050487
1、在系統中注冊主機頭
使用文本編輯工具編輯C:\Windows\System32\drivers\etc\hosts
文件,在文件中添加一行記錄如下所示: 127.0.0.1 oneym.dev
2、啟用Apache的vhost功能
定位到C:\xampp\apache\conf\httpd.conf
文件開始編輯,使用編輯器的搜索功能ctrl+F
搜索mod_vhost_alias.so
;找到相應代碼后,去掉代碼前面的#號,編輯完成后如下所示: LoadModule vhost_alias_module modules/mod_vhost_alias.so
3、配置Apache的vhost功能
編輯C:\xampp\apache\conf\extra\httpd-vhosts.conf
文件,在文件末尾添加如下代碼:
<VirtualHost *:80>
DocumentRoot "C:/xampp/htdocs/php"
ServerName oneym.dev
ErrorLog "logs/oneym.dev-error.log"
CustomLog "logs/oneym.dev-access.log" common
</VirtualHost>
4、重啟Apache服務器
使用控制面板可以快速重啟Apache服務器,截圖如下: