通过浏览器访问站点时出现 403(Access Forbidden) 错误
getting 403(Access Forbidden) error while accessing the site through browser
您好,我在通过浏览器访问我的实时网站时遇到 403 错误。昨天工作正常。我不确定为什么会出现此错误。我已经搜索了很多。这些是我尝试过的解决方案:
我已将 httpd.conf 文件的配置从默认更改为:
<Directory />
#Options FollowSymLinks
Options Indexes FollowSymLinks Includes
AllowOverride All
Order deny,allow
Allow from all
</Directory>
已将 /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
如果您还有其他需要,请在评论中告诉我。提前致谢:)
您可以尝试以下步骤:
- 在 httpd.conf 文件选项中 -Indexes +FollowSymLinks +MultiViews +Includes
- 运行 在终端上:chown -R apache:apache /var/www/html
- 重新启动 Apache
我正在尝试为 Apache/2.2.29 设置虚拟主机。 AWS EC2 实例。
遇到同样的错误。
我通过查看 error.log
来解决它
我需要给父文件夹755
在您的错误日志中“文件不存在:/var/www/error/noindex.html”
意味着你需要有这个文件夹和文件。
我用的是chmod 755 -R /var/www/
SE Linux 为每个文件设置安全上下文标签。如果设置安全上下文标签时出错,系统会抛出禁止错误。
使用 "restorecon -v R" 和文件目录的路径名可以清除禁止的错误。
"restorecon" 命令将默认安全上下文恢复到文件。
您好,我在通过浏览器访问我的实时网站时遇到 403 错误。昨天工作正常。我不确定为什么会出现此错误。我已经搜索了很多。这些是我尝试过的解决方案:
我已将 httpd.conf 文件的配置从默认更改为:
<Directory /> #Options FollowSymLinks Options Indexes FollowSymLinks Includes AllowOverride All Order deny,allow Allow from all </Directory>
已将
/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
如果您还有其他需要,请在评论中告诉我。提前致谢:)
您可以尝试以下步骤:
- 在 httpd.conf 文件选项中 -Indexes +FollowSymLinks +MultiViews +Includes
- 运行 在终端上:chown -R apache:apache /var/www/html
- 重新启动 Apache
我正在尝试为 Apache/2.2.29 设置虚拟主机。 AWS EC2 实例。 遇到同样的错误。 我通过查看 error.log
来解决它我需要给父文件夹755
在您的错误日志中“文件不存在:/var/www/error/noindex.html” 意味着你需要有这个文件夹和文件。
我用的是chmod 755 -R /var/www/
SE Linux 为每个文件设置安全上下文标签。如果设置安全上下文标签时出错,系统会抛出禁止错误。 使用 "restorecon -v R" 和文件目录的路径名可以清除禁止的错误。 "restorecon" 命令将默认安全上下文恢复到文件。