Apache “No Permission” – 403 forbidden

apache-2.2chmodhttp-status-code-403permissions

I've accidentally performed a wrong chown update this morning and now my /var/www permissions are all wrong.

I'm unable to access anything anymore, apache will always say I do not have permission to view this page, like:

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

(even after chmodding everything to 777, or chowning it to www-data)

Does anyone have any clue on what's going wrong?

Best Answer

A number of things could be going wrong.

First thing is to look in your error log (maybe in /var/log/apache2/error_log) and look for the Apache reason for failing to serve this location.

Next is to check your directory permissions up to your document root. E.g. if your document root is in /var/www/htdocs then you need to ensure the Apache user has +x permissions on the directories /, /var, /var/www, and /var/www/htdocs.

Test whether you can access these directories yourself:


su www-data
ls /
ls /var
ls /var/www
ls /var/www/htdocs
exit

Are you sure www-data is the right user? Try typing ps uax and look for the user the Apache process is running as.

Otherwise it could be Apache deciding not to serve the files for some other reason.