25

今天我将我的图像从一台服务器迁移到另一台服务器并遇到了一个奇怪的权限问题

[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
4

7 回答 7

30

今天我遇到了这个问题。我将 public_html 从旧驱动器转移到新驱动器并像这样 chown:

chown -R owner:owner public_html

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

chown owner:nobody public_html

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

于 2013-11-05T08:49:36.480 回答
22

我有同样的问题。对我来说,这是 SeLinux (CentOS 7) 的问题。

这个对我有用:

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

请注意,您应该将以上内容更改/var/www/html/为适当的目录。

于 2017-10-20T02:36:59.267 回答
3

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

于 2017-10-06T14:27:31.397 回答
2

另一种方式是

sudo setenforce 0

禁用 SELinux

我希望这对你有用

于 2020-07-01T11:46:09.717 回答
1

TL;博士:

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>;)。

于 2015-02-20T20:34:57.820 回答
1

打开您的 httpd.conf 文件并将 .htaccess 文件中的 Deny from all 更改为 Allow from all

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

由 Web 客户端查看。

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

这解决了我的问题

于 2017-05-02T04:44:22.353 回答
-1

当我检查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

有关 5.0 中新更改 Apache / Webserver 限制的更多详细信息

于 2015-01-09T11:10:49.170 回答