php Forbidden 您无权访问 / 在此服务器上。服务器无法读取 htaccess 文件,拒绝访问是安全的

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/32303895/
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

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-25 22:53:47  来源:igfitidea点击:

Forbidden You don't have permission to access / on this server. Server unable to read htaccess file, denying access to be safe

phpapache.htaccesshttpforbiddenhandler

提问by user3692451

Right now I'm getting this message in a single site of my whole reseller account: Forbidden

现在,我在整个经销商帐户的一个站点中收到此消息:禁止访问

You don't have permission to access / on this server. Server unable to read htaccess file, denying access to be safe

Additionally, a 403 Forbidden error was encountered while trying to use an ErrorDocument to handle the request.

您无权访问 / 在此服务器上。服务器无法读取 htaccess 文件,拒绝访问是安全的

此外,在尝试使用 ErrorDocument 处理请求时遇到 403 Forbidden 错误。

It happened all of a sudden. I tried renaming the root htaccess to anything else, and the error is still there, I even tried setting up 744 permissions to the file, still the same thing. Currently the file is using the default files permissions, 644. The error is ocuring at: http://lucrebem.com.br

它突然发生了。我尝试将根 htaccess 重命名为其他任何内容,但错误仍然存​​在,我什至尝试为文件设置 744 权限,仍然是同样的事情。目前该文件正在使用默认文件权限 644。错误发生在:http://lucrebem.com.br

回答by user3692451

So the problem was that the public_html folder changed permissions to 744, but I never changed it. I solved it changed the permissions to 750. But how do I see the logs??? Because I never did a change on that folder, I'm afraid it might have been an attack.

所以问题是 public_html 文件夹将权限更改为 744,但我从未更改它。我解决了将权限更改为 750 的问题。但是我如何查看日志???因为我从未对该文件夹进行过更改,所以我担心它可能是一次攻击。

回答by MarshallOfSound

You need to add a <Directoryblock to your apache config

您需要<Directory在 apache 配置中添加一个块

<Directory "/path/to/source/file/directory/www">
    Options Indexes FollowSymLinks
    AllowOverride all
    Require all granted
</Directory>

This grants the required permission

这将授予所需的权限