0

The only <Directory> I have among all Apache config files is:

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

Actually the real directory on server is /var/www/html/. The directory /var/www/ has no file, but only the subdir html.

So accessing the root of my website should fail, because /var/www/index.html doesn't exist. But it doesn't fail, the content of /var/www/html/index.html is displayed, even if I didn't specify it in the config file.

Why?

Basj
  • 41,386
  • 99
  • 383
  • 673

1 Answers1

1

<Directory> sections cover the specified directory and any subdirectory.

Something like DocumentRoot, VirtualDocumentRoot, Alias, RewriteRule, or FallBackResource could exist in an Apache config file or .htaccess that maps / to /var/www/html without any <Directory> section explicitly listing it.

Edit: if apachectl -S shows Main DocumentRoot: "/var/www/html" even if this is specified nowhere in your config files, this means that this value is compiled-in default in your Apache build.

Basj
  • 41,386
  • 99
  • 383
  • 673
covener
  • 17,402
  • 2
  • 31
  • 45
  • As discussed on IRC, I added: *if `apachectl -S` shows `Main DocumentRoot: "/var/www/html"` even if this is specified nowhere in your config files, this means that this value is compiled-in default in your Apache build.*, that was true for me – Basj Nov 30 '16 at 23:29