简体   繁体   English

通过浏览器访问网站时出现403(禁止访问)错误

[英]getting 403(Access Forbidden) error while accessing the site through browser

Hi I'm getting 403 error while im accessing my live site through the browser. 嗨,我通过浏览器访问我的实时网站时收到403错误。 It was working fine last day. 昨天工作正常。 I'm not sure why this error is coming. 我不确定为什么会出现此错误。 I have searched a lot about it. 我已经搜索了很多。 These are the solutions I have tried: 这些是我尝试过的解决方案:

  1. I have changed my httpd.conf file's configurations from default to : 我已将httpd.conf文件的配置从默认更改为:

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

  2. Changed the permission for /var/www/html directory from default to 777 /var/www/html目录的权限从默认更改为777

and few more things. 还有几件事。 But nothing worked. 但是没有任何效果。 I am not sure what is going wrong. 我不确定出了什么问题。

My server configurations are: 我的服务器配置为:

Apache/2.2.29. 阿帕奇/ 2.2.29。 AWS EC2 Instance. AWS EC2实例。

This is the Error message shown on browser: 这是浏览器上显示的错误消息:

forbidden 被禁止

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.

This is the Error message from error_logs : 这是来自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

please let me know in comments if you need anything else. 如果您还有其他需要,请在评论中让我知道。 Thanks in advance :) 提前致谢 :)

I was trying to set up vhost for Apache/2.2.29. 我试图为Apache / 2.2.29设置虚拟主机。 AWS EC2 Instance. AWS EC2实例。 meet same error . 遇到同样的错误。 I solve it by looking the error.log 我通过查看error.log来解决它

I need to give 755 to the parent folder 我需要将755分配给父文件夹

in your error log " File does not exist: /var/www/error/noindex.html" means you need to have this folder and the file. 在错误日志中,“文件不存在:/var/www/error/noindex.html”表示您需要此文件夹和文件。

what I use is chmod 755 -R /var/www/ 我使用的是chmod 755 -R /var/www/

You can try following steps: 您可以尝试执行以下步骤:

  1. In httpd.conf file Options -Indexes +FollowSymLinks +MultiViews +Includes 在httpd.conf文件中,选项-Indexes + FollowSymLinks + MultiViews + Includes
  2. Run on terminal: chown -R apache:apache /var/www/html 在终端上运行:chown -R apache:apache / var / www / html
  3. Restart Apache 重新启动Apache

SE Linux sets security context label to every file. SE Linux为每个文件设置安全上下文标签。 If there is an error setting the security context label the system throws forbidden error. 如果设置安全上下文标签时发生错误,则系统将抛出禁止的错误。 Using "restorecon -v R" along with path name of the file's directory can clear the forbidden error. 将“ restorecon -v R”与文件目录的路径名一起使用可以清除禁止的错误。 The "restorecon" command restores the default security context to the file. “ restorecon”命令将默认安全上下文恢复到该文件。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM