标签 Apache 下的文章

Mac升级了系统,发现启动了Apache,可以访问index.php文件。
当目录下找不到文件的时候,应该显示Indexes目录,
此时报错Forbidden 403 You don't have permission to access /www on this server
原因是Apache2.2版config默认设置是:

<Directory />
    AllowOverride none
    Allow from all
</Directory>

Apache2.4 config默认设置是:

<Directory />
    AllowOverride none
    Require all denied
</Directory>

最佳方案,目标<Directory>下设置文件访问权限为:
Allow from all
参考:https://www.zyxware.com/articles/4550/solved-forbidden-you-dont-have-permission-to-access-on-this-server

set http.conf
# ...http_vhost.conf 取消注释#
# ServerName www.example.com 打开
set http.vhost.conf For OSX 10.10 Apache 2.4
设置虚拟机

<Directory "/Users/username/Sites/">
AllowOverride All
Options Indexes MultiViews FollowSymLinks
Require all granted
</Directory>

set php
LoadModule php5_module libexec/apache2/libphp5.so
修改文件权限 chmod 777 MetInfo5.3