Linux htaccess pcfg_openfile: 无法检查 htaccess 文件,确保它是可读的,并且“/files/domain.com/public_html/images/”是可执行的
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/15607300/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
htaccess pcfg_openfile: unable to check htaccess file, ensure it is readable and that '/files/domain.com/public_html/images/' is executable
提问by teslasimus
Today i migrated my images from one server to another and faced a strange permission issue
今天我将我的图像从一台服务器迁移到另一台服务器,并面临一个奇怪的权限问题
[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
what i've tried:
我试过的:
chmod -R 777 root_dir
restorecon -r
disable selinux
Chown -R root:root root_dir
回答by Ali
Today I faced this problem. I transferred public_html from the old drive to new one and chown like this:
今天我遇到了这个问题。我将 public_html 从旧驱动器转移到新驱动器,然后像这样 chown:
chown -R owner:owner public_html
This is correct for sub directories and files inside public_html, but the user of public_html must be nobody so apache can check it's content, so this solved my problem:
这对于public_html中的子目录和文件是正确的,但是public_html的用户必须是nobody所以apache可以检查它的内容,所以这解决了我的问题:
chown owner:nobody public_html
Note: owneris the user (for example web1)
注意:owner是用户(例如 web1)
回答by ken
When I checked httpd/user-error_log
, it gave
当我检查时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 is not fixing the problem. Below command is what works for me. I use http since it is the apache user and group used in Synology DSM 5.1-5021
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
more details about the new change Apache / Webserver limitations in 5.0
有关5.0 中 Apache / Webserver 限制的新更改的更多详细信息
回答by Karl Wilbur
TL;DR:
特尔;博士:
sudo chmod a+rx /var{,/services{,/web{,/web-folder}}};
find /var/services/web/web-folder -type d -exec sudo chmod a+rx {} +;
You need to make certain that the directory, and all of its parent directories, are readable and executable (executability is required to open a directory) by the web server. You can do this by making the web server user the owner and making the user perms (EG: chown apache <dir>; chmod u+rx <dir>;
), or by a making the group be the web server group a group which includes the web server user and setting the group perms to (EG: chgrp apache <dir>; chmod g+rx <dir>;
), or by setting the world perms to (EG: chmod o+rx <dir>;
).
您需要确保该目录及其所有父目录可由 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>;
)。
回答by Emmanuel Jimmy Dedume
open your httpd.conf file and change Deny from all to Allow from all on the .htaccess file
打开您的 httpd.conf 文件并将 .htaccess 文件中的全部拒绝更改为全部允许
The following lines prevent .htaccess and .htpasswd files from being
以下几行防止 .htaccess 和 .htpasswd 文件被
viewed by Web clients.
Web 客户端查看。
<FileMatch "^\.ht">
Order allow,dey
Allow from all
</FileMatch>
this solved my problem
这解决了我的问题
回答by Vishal Shetty
I was using Plesk onyx and I got the same error message, I just changed the folder permission to 775 and it worked for me.
我正在使用 Plesk onyx 并且收到相同的错误消息,我只是将文件夹权限更改为 775 并且它对我有用。
回答by shintaroid
I had the same problem. For me, it's a problem of SeLinux (CentOS 7).
我有同样的问题。对我来说,这是 SeLinux (CentOS 7) 的问题。
It works for me:
这个对我有用:
$ setsebool -P httpd_enable_homedirs true
$ chcon -R -t httpd_sys_content_t /var/www/html/
Note that you should change the above /var/www/html/
to an appropriate directory.
请注意,您应该将上述内容更改为/var/www/html/
适当的目录。