<VirtualHost *:80>
DocumentRoot "/Users/xb/www/study"
ServerName frontendx.study
<Directory "/Users/xb/www/study">
# AllowOverride All # Deprecated
# Order Allow,Deny # Deprecated
# Allow from all # Deprecated
# --New way of doing it
Require all granted
</Directory>
</VirtualHost>
在mac下配置完apache和PHP環境后,通過localhost訪問頁面,出現403Forbidden。頁面提示
Forbidden
You don’t have permission to access / on this server.
1:解決辦法是修改/etc/apache/httpd.conf的配置
2:如果你只要配置虛擬主機,可以在虛擬主機里面寫這個配置
如果apache版本是2.2的話,應該這么寫
<Directory "/Users/apple/Sites/">
Options Indexes MultiViews
AllowOverride All
# OSX 10.9 / Apache 2.2
Order from deny, allow
</Directory>
如果apache版本是2.4的話,應該這么寫
<Directory "/Users/apple/Sites/">
Options Indexes MultiViews
AllowOverride All
# OSX 10.10 / Apache 2.4
Require all granted
</Directory>