Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

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?

share|improve this question
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 '10 at 13:53

3 Answers 3

up vote 3 down vote accepted

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.

share|improve this answer
    
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 '10 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 '11 at 0:45

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.

share|improve this answer

The answer is probably in the logs,

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

then reload the page in the browser.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.