I just set up the apache2/mysql server to play around with. But I found the something different than what I saw before. The root directory is pointed to /var/www/html/. I checked the /etc/apache2/apache2.conf file ,and says

<Directory /var/www/>
    Options Indexes FollowSymLinks
    AllowOverride None
    Require all granted

This says the root directory points to /var/www/. Is this a bug ? And I also want to know why they made /var/www/html instead of /var/www/.


Usually the default configuration (eg. /var/www/html) is defined in /etc/apache2/sites-enabled and is overriding what's in your apache2.conf. This is normal behaviour, and it's common practice to add your vhost config as separate files in /etc/apache2/sites-available then symlink the enabled ones to /etc/apache2/sites-enabled.

If you want to edit the default config edit /etc/apache2/sites-available/000-default.conf.

  • how to open this directory /var/www/html – 151291 Feb 22 '16 at 13:06

The Directory directive doesn't define the root. Rather it defines how Apache should treat files inside that directory, if they are being served. Files outside the root could also be served if they were accessed through an Alias.

The reason the Apache configuration sets the options for all of /var/www might be such that you can easily have multiple sites, each with their own DocumentRoot. That way you don't have to repeat Directory in each site.


you can costumize root directory every where that you want. it's not a bug. it had a reason that they change it. they want to not to put files directly into www directory.

  • I think it should point like this <Directoy /var/www/html> on default, otherwise it's just confusing. Anyway thanks. – Peco Aug 31 '14 at 6:01
  • as developer, you don't have permission to change apache.conf, so you must put your configs in haccess. and they can't change apache.conf if they do, maybe your customized configs will be remove. – Morteza Soltanabadiyan Aug 31 '14 at 6:04
  • @MortezaSoltanabadiyan he's asking why it says /var/www in apache2.config but the actual root is /var/www/html. It's nothing to do with htaccess files. – thexacre Aug 31 '14 at 6:15

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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