Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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/.

share|improve this question
It doesn't say what you think it does. – Iain Aug 31 '14 at 6:02
up vote 3 down vote accepted

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.

share|improve this answer
Thank you very much!! It works :) – Toshi Aug 31 '14 at 6:33
how to open this directory /var/www/html – 151291 Feb 22 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.

share|improve this answer

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.

share|improve this answer
I think it should point like this <Directoy /var/www/html> on default, otherwise it's just confusing. Anyway thanks. – Toshi 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 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.