Apache Permission Denied问题

配置好apache的虚拟主机之后访问出现错误 

Forbidden
You don't have permission to access / on this server.

查看日志发现如下错误 

(13)Permission denied: access to / denied (filesystem path '/home/xxx/') because search permissions are missing on a component of the path

判断这个问题首先出现了日志应该apache是可以访问的,然后判断可能会是apache配置站点访问权限的问题,检查了一下conf文件如下:

 1 <VirtualHost *:9990>
 2     ServerName be.daozhang.org
 3     DocumentRoot /home/daozhang/git/public
 4 
 5     ErrorLog /var/log/httpd/daozhang/error_log
 6     CustomLog /var/log/httpd/daozhang/be_access_log combined
 7     <Directory "/home/daozhang/git/public">
 8         Options -Indexes MultiViews FollowSymLinks
 9         AllowOverride All 
10         Order allow,deny
11         Allow from all
12     </Directory>
13 </VirtualHost>

这个是没问题的,然后判断应该是代码目录的权限问题,apache对代码目录需要755的权限,也就是x权限,使用ls -la查看了一下public文件夹是没问题的,然后apache需要父层文件夹都具有x权限,后来检查时/daozhang这一层没有,使用chmod +x daozhang修改后成功访问。

补充:nginx会出现File not Found错误的时候也可以查看日志是不是没有访问权限。

参考 http://wiki.apache.org/httpd/13PermissionDenied

原文地址:https://www.cnblogs.com/songxk/p/4514541.html