Basj Basj - 1 year ago 80
Apache Configuration Question

Why does Apache find the website directory automatically?

The only

I have among all Apache config files is:

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

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

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


Answer Source

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

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download