linux - 通过浏览器访问站点时出现 403(Access Forbidden) 错误

标签 linux apache amazon-web-services amazon-ec2

您好,我在通过浏览器访问我的实时网站时遇到 403 错误。昨天工作正常。我不确定为什么会出现此错误。我已经搜索了很多。这些是我尝试过的解决方案:

  1. 我已将我的 httpd.conf 文件的配置从默认更改为:

    <Directory /> #Options FollowSymLinks Options Indexes FollowSymLinks Includes AllowOverride All Order deny,allow Allow from all </Directory>

  2. 更改了 /var/www/html 的权限目录从默认到 777

还有一些东西。但没有任何效果。我不确定出了什么问题。

我的服务器配置是:

Apache /2.2.29。 AWS EC2 实例。

这是浏览器上显示的错误信息:

禁止

You don't have permission to access / on this server.

Additionally, a 404 Not Found error was encountered while trying to use an ErrorDocument to handle the request.

这是来自 error_logs 的错误消息:

[Thu May 21 14:58:51 2015] [error] [client XXX.XXX.XXX.XXX] Directory index forbidden by Options directive: /var/www/
[Thu May 21 14:58:51 2015] [error] [client XXX.XXX.XXX.XXX] File does not exist: /var/www/error/noindex.html

如果您需要其他任何东西,请在评论中告诉我。提前致谢:)

最佳答案

我正在尝试为 Apache/2.2.29 设置虚拟主机。 AWS EC2 实例。 遇到同样的错误。 我通过查看 error.log 来解决它

我需要给父文件夹755

在您的错误日志中“文件不存在:/var/www/error/noindex.html” 意味着你需要有这个文件夹和文件。

我用的是chmod 755 -R/var/www/

关于linux - 通过浏览器访问站点时出现 403(Access Forbidden) 错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/30378534/

相关文章:

linux - 如何更改具有读/写/执行权限的目录中上传的所有 future 文件的权限

c++ - 如何正确处理 SIGBUS 以便我可以继续搜索地址?

amazon-web-services - 将 AWS EFS 与 Docker 结合使用

amazon-web-services - EC2 没有响应 ssh 连接

linux - MONO WCF 是否支持 Azure 服务总线中继

apache - 如何让 PHP 显示错误而不是给我 500 Internal Server Error

php - 在 PHP/Apache 中提供大型 protected 文件

angular - 使用 SSL 证书在 apache2 上部署 Angular

amazon-web-services - 无法访问 ec2 上新连接的网络接口(interface) ip

android - 如何在 android 3.x 上运行 linux 命令挂载和卸载 sd 卡