5

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?

1
  • 1
    Did you do a recursive chown/chmod? If any of the directories aren't accessible in the path, you'll get a permission denied message.
    – Joe H.
    Feb 11, 2010 at 13:53

3 Answers 3

4

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.

2
  • you're assuming the apache server runs as 'www-data', which might not be the case -- some of us keep our webserver running as a user that only has read access to the files, which means the files aren't owned by the same user as apache runs as.
    – Joe H.
    Feb 11, 2010 at 13:51
  • I just want to thank you for this answer. I finally solved my problem after several hours of messing with this stuff. I didn't realize that all of the directories in the path needed access, although it seems obvious now. Thanks again!
    – Andy Groff
    Apr 2, 2011 at 0:45
1

This is likely a result of not having an index.html file in that directory and your Apache directives not allowing you to view directory listings. Try putting some text in an index.html file in your document root.

1

The answer is probably in the logs,

sudo tail -f /var/log/apache/{error,access}.log

then reload the page in the browser.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .