安装好Apache 2.4.23并启动服务后,访问任何页面都出现403错误,和以前的版本不同,错误提示多了以下一句:
Server unable to read htaccess file, denying access to be safe
于是打开apache错误日志(默认是apache安装目录/logs/error_log),发现如下日志:
[Mon Sep 12 12:10:29.497929 2016] [core:crit] [pid 6412:tid 140242582202112] (13)Permission denied: [client 10.9.18.133:53255] AH00529: /home/fynas/.htaccess pcfg_openfile: unable to check htaccess file, ensure it is readable and that ‘/home/fynas/’ is executable
于是就按提示在/home/fynas/下新建了“.htaccess”文件,写入如下内容并保存:
1 2 3 |
Order allow,deny Allow from all Require all granted |
再将目录设置为可执行
1 |
chmod -R 755 /home/fynas/ |
同时修改apache配置文件中Directory节点,大致如下:
1 2 3 4 5 |
<Directory "/home/fynas/www"> Options FollowSymLinks AllowOverride all Require all granted #新版本apache变成这样的 </Directory> |
重启apache再访问就ok了。
参考文章: