(13)centos 上 apache 权限被拒绝

(13)centos 上 apache 权限被拒绝

当访问 domain.com 时出现此错误domain.com-error_log

[Mon Aug 20 17:07:48 2012] [error] [client X.X.X.X] (13)Permission denied: access to / denied

我有以下虚拟主机domain.com

<VirtualHost *:80>
    ServerAdmin [email protected]
    DocumentRoot /home/kir/domain.com
    ServerName domain.com
    ServerAlias *.domain.com
    ErrorLog logs/domain.com-error_log
    CustomLog logs/domain.com-access_log common
    Options -Indexes +FollowSymLinks
    <Directory /home/kir/domain.com>
        RewriteEngine on
        Order allow,deny
        AllowOverride all
        Allow from all
    </Directory>
</VirtualHost>

DocumentRoot/home/kir/domain.com/拥有的权限:Permissions: drwxr-xr-x (0755); User: kir/kir

重新启动 httpd 后,我有以下内容error.log

[Mon Aug 20 17:04:39 2012] [notice] caught SIGTERM, shutting down
[Mon Aug 20 17:04:40 2012] [notice] SELinux policy enabled; httpd running as context root:system_r:httpd_t
[Mon Aug 20 17:04:40 2012] [notice] suEXEC mechanism enabled (wrapper: /usr/sbin/suexec)
[Mon Aug 20 17:04:40 2012] [notice] Digest: generating secret for digest authentication ...
[Mon Aug 20 17:04:40 2012] [notice] Digest: done
[Mon Aug 20 17:04:40 2012] [notice] Apache/2.2.22 (Unix) DAV/2 PHP/5.3.15 configured -- resuming normal operations

由于我使用的是 CentOs,我尝试禁用 SELinux ( /etc/selinux/config.conf SELINUX=disabled; reboot)。禁用 SELinux 后,我再次尝试 - 还是同样的结果,同样的错误 (13)权限被拒绝...

UPD:访问domain.com/test.html(此文件存在于DocumentRoot中)时出现同样的情况(13)权限被拒绝。

有任何想法吗?

答案1

你的父目录DirectoryRoot必须可被 Apache 访问,因此你必须确保 Apache 具有 的执行权限/home/kir

chmod 0755 /home/kir

或者

chown kir:apache /home/kir
chmod 0750 /home/kir

相关内容