On my Ubuntu server, I've changed my /var/www directory to a subfolder inside of my home directory, and I'm now getting 403 "Forbidden" errors in my browser. I've read through a lot of similar questions, but none of the answers have worked for me. These are the steps I've followed:

In /etc/apache2/apache2.conf, I changed

<Directory /home/var/www>


<Directory /home/bob/Dropbox/Uniserver/www>

I did the same thing in /etc/apache2/sites-available/000-default.conf:

DocumentRoot /var/www


DocumentRoot /home/bob/Dropbox/UniServer/www

(Only for troubleshooting), I ran:

chmod 777 -R /home/bob/Dropbox/UniServer/www

I also ran:

chown -R www-data /home/bob/Dropbox/UniServer/www

Also for troubleshooting, I ran the same command for my entire home directory. I restarted Apache a million times:

sudo service apache2 restart

But typing 'localhost' into my browser still returns a 403 "Forbidden" error. Any ideas?

  • I know you said this is just for troubleshooting, but you never want, or need, to give world-write access to your web folder, and you want to avoid giving write access to the www-data user/group to anything. Read-only access is enough, and is much preferred for security reasons. Sorry this doesn't answer your question though. – thomasrutter Dec 9 '14 at 6:25
  • Can you find the relevant lines from /var/log/apache2/error.log (hope I'm remembering correctly) when this 403 forbidden error occurs? You may need to use sudo to even look in that log directory. – thomasrutter Dec 9 '14 at 6:27
  • What is the output of sudo -u www-data namei -l /home/bob/Dropbox/UniServer/www? – muru Dec 9 '14 at 7:28
  • Did you download apache, MYSQL and PHP seperatly? Or did you get a stack (e.g. XAMPP)? – SomeAmbigiousUserName Dec 9 '14 at 8:57

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Browse other questions tagged or ask your own question.