This question already has an answer here:

So I just installed a virtual machine with Ubuntu 13.10. I wanted to play with apache 2.4.6 before I update my ubuntu 12.04 servers. I want my document root to be in my home folder and so I changed it in the etc/apache2/sites-available/000-default.conf

When I did that I just get the forbidden message. I set the new folder permissions to 777 but still get forbidden. I even put an index.html file in the new directory that just says hello world but nothing still. Here is my 000-default.conf file.

<VirtualHost *:80>
# The ServerName directive sets the request scheme, hostname and port that
# the server uses to identify itself. This is used when creating
# redirection URLs. In the context of virtual hosts, the ServerName
# specifies what hostname must appear in the request's Host: header to
# match this virtual host. For the default virtual host (this file) this
# value is not decisive as it is used as a last resort host regardless.
# However, you must set it for any further virtual host explicitly.
#ServerName www.example.com

ServerAdmin webmaster@localhost
DocumentRoot /home/everett/webroot

<Directory /home/everett/webroot>
    Options FollowSymLinks MultiViews
    AllowOverride All
    Order allow,deny
    allow from all
</Directory>


# Available loglevels: trace8, ..., trace1, debug, info, notice, warn,
# error, crit, alert, emerg.
# It is also possible to configure the loglevel for particular
# modules, e.g.
#LogLevel info ssl:warn

ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined

# For most configuration files from conf-available/, which are
# enabled or disabled at a global level, it is possible to
# include a line for only one particular virtual host. For example the
# following line enables the CGI configuration for this host only
# after it has been globally disabled with "a2disconf".
#Include conf-available/serve-cgi-bin.conf
</VirtualHost>

# vim: syntax=apache ts=4 sw=4 sts=4 sr noet

marked as duplicate by Mitch Jul 25 '14 at 1:14

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

  • tl;dr, Set your VirtualHosts properly – OverCoder Oct 4 '16 at 23:04

I had the exact same problem and I solved it like this:

First; I followed the steps as explained on the Ubuntu Server Guide Pages

  1. Go to terminal and copy the default virtual host configuration to a new one (sudo cp /etc/apache2/sites-available/000-default.conf /etc/apache2/sites-available/mynewsite.conf)
  2. Edit this new file (sudo gedit /etc/apache2/sites-available/mynewsite.conf) and change the DocumentRoot to your own (save and close..)
  3. Enable this new configuration file (sudo a2ensite mynewsite.conf) and dissable the default one (sudo a2dissite 000-default.conf)
  4. Edit the apache2.conf (sudo gedit /etc/apache2/apache2.conf) and change the default -section into this: <Directory [write_your_dir_here]> Options Indexes FollowSymLinks AllowOverride None Require all granted </Directory> (save and close..)
  5. Restart Apache2 (sudo service apache2 restart)

If it already works: great!


If not then you should check if every named based <VirtualHost *:80> requires a distinct ServerName set, including 000-default.conf if it exists. You can run apachectl -S in the terminal to see a quick list of everything.


If it still does not work then you should check if your directory (and the full path leading up to it!) has the right read and execute-permissions (r-x).

  1. Go to your root (cd /) and do ls -l where you can see something like drwxr-xr-x 14 root root 4096 mei 1 01:24 [your_directory].
  2. All your directories leading up to the www-folder should have the "drwxr-xr-x"-permissions, if not you can change it using sudo chmod -R a+rx [your_directory]

If you still can't get it to work, you should check the apache error-log (sudo gedit /var/log/apache2/error.log) and dig further...

Good luck!

  • 1
    Permission denied: Can't open directory for index: – itsazzad Jun 13 '14 at 18:18
  • In case you have multiple domain names on VPS, these steps work fine except for step 3, you shouldn't disable 000-default.conf – Waiyl Karim May 26 '15 at 11:13

Dear I wanted to inform you that you are changing your default apache configuration.

Remove these line from your 000-default.conf file.

<Directory /home/everett/webroot>
Options FollowSymLinks MultiViews
AllowOverride All
Order allow,deny
Require all granted
</Directory>

Open your your apache.conf file (/etc/apache2/apache.conf) and find out Directory or go to line no. 172. where you find out "directory /var/www/" Define your Directory "/home/everett/webroot" here save and restart your apache and refresh your web page.

  • Thank you! They seemed to have changed a lot of things from apache 2.2 to 2.4 – evaldez Feb 2 '14 at 5:53
  • 1
    there is no 000-default.conf file in ubuntu14.04 with Xampp 1.8.3 – diEcho Nov 24 '14 at 6:21
  • doing this in the related site's conf file is the better way than adding it to major apache2.conf file. so that you can find it and change at any time rather than editing main file. if there are too many sites, you will be weird to edit main file – Janaka R Rajapaksha Dec 4 '14 at 14:29

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