htaccess pcfg_openfile:无法检查htaccess文件,确保它是可读的并且' /files/domain.com/public_html/images /'是可执行的

时间:2013-03-25 03:47:11

标签: linux apache security permissions nginx

今天我将我的图像从一台服务器迁移到另一台服务器并面临一个奇怪的许可问题

[Mon Mar 25 08:42:23.676315 2013] [core:crit] [pid 15182] (13)Permission denied: [client 24.14.2.22:48113] AH00529: /files/domain.com/public_html/images/.htaccess pcfg_openfile: unable to check htaccess file, ensure it is readable and that '/files/domain.com/public_html/images/' is executable, referer: http://domain.com.com/file.php

我尝试了什么:

    chmod -R 777 root_dir
    restorecon -r
    disable selinux
    Chown -R root:root root_dir

7 个答案:

答案 0 :(得分:27)

今天我遇到了这个问题。我将public_html从旧驱动器转移到新驱动器,并按照以下方式进行调整:

chown -R owner:owner public_html

这对于public_html中的子目录和文件是正确的,但是public_html的用户必须是nobody,所以apache可以检查它的内容,所以这解决了我的问题:

chown owner:nobody public_html

注意:所有者是用户(例如web1)

答案 1 :(得分:9)

我遇到了同样的问题。对我来说,这是SeLinux(CentOS 7)的一个问题。

它对我有用:

$ setsebool -P httpd_enable_homedirs true
$ chcon -R -t httpd_sys_content_t /var/www/html/

请注意,您应将上述/var/www/html/更改为相应的目录。

答案 2 :(得分:2)

我正在使用Plesk onyx,我收到了相同的错误消息,我只是将文件夹权限更改为775,这对我有用。

答案 3 :(得分:2)

其他方法是

sudo setenforce 0

Disable SELinux

我希望这对您有用

答案 4 :(得分:1)

TL; DR:

sudo chmod a+rx /var{,/services{,/web{,/web-folder}}};
find /var/services/web/web-folder -type d -exec sudo chmod a+rx {} +;

您需要确保Web服务器的目录及其所有父目录是可读和可执行的(可执行性是打开目录所必需的)。您可以通过使Web服务器用户成为所有者并创建用户权限(EG:chown apache <dir>; chmod u+rx <dir>;),或者通过使组成为Web服务器组(包括Web服务器用户并设置组)来执行此操作烫发(EG:chgrp apache <dir>; chmod g+rx <dir>;),或将世界烫发设定为(EG:chmod o+rx <dir>;)。

答案 5 :(得分:1)

打开你的httpd.conf文件,并将全部拒绝改为.htaccess文件中的全部允许

以下行阻止.htaccess和.htpasswd文件为

由Web客户端查看。

<FileMatch "^\.ht">
  Order allow,dey
  Allow from all
</FileMatch>

这解决了我的问题

答案 6 :(得分:0)

当我检查httpd/user-error_log时,它给出了

[Fri Jan 09 18:58:08 2015] [crit] [client 192.168.1.xxx] (13)Permission
denied: /var/services/web/web-folder/.htaccess pcfg_openfile: unable to check
htaccess file, ensure it is readable

chmod 755没有解决问题。以下命令对我有用。我使用http,因为它是Synology DSM 5.1-5021中使用的apache用户和组

  cd /var/services/web
  chown http:http web-folder


 apache httpd.conf @ /etc/httpd/conf/httpd.conf

有关新变化的更多细节 Apache / Webserver limitations in 5.0