简体   繁体   中英

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. 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 :

    <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

and few more things. But nothing worked. I am not sure what is going wrong.

My server configurations are:

Apache/2.2.29. AWS EC2 Instance.

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 :

[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. AWS EC2 Instance. meet same error . I solve it by looking the error.log

I need to give 755 to the parent folder

in your error log " File does not exist: /var/www/error/noindex.html" means you need to have this folder and the file.

what I use is chmod 755 -R /var/www/

You can try following steps:

  1. In httpd.conf file Options -Indexes +FollowSymLinks +MultiViews +Includes
  2. Run on terminal: chown -R apache:apache /var/www/html
  3. Restart Apache

SE Linux sets security context label to every file. 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. The "restorecon" command restores the default security context to the file.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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