Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

I was playing with the apache configuration files after a system restore when I noticed something I have never really though about too much. Here are the first lines of the default /etc/apache2/sites-available/default:

DocumentRoot /var/www
<Directory />
    Options FollowSymLinks
    AllowOverride None
</Directory>
<Directory /var/www/>
    Options Indexes FollowSymLinks MultiViews
    AllowOverride None
    Order allow,deny
    allow from all
 </Directory>

Since the root of a web server is usually /var/www, why is there the need to add a <Directory /> in here?

share|improve this question
    
The <Directory> directive (and <Files> as well), apply directives to parts of the file system. –  Christopher Apr 18 at 20:45

1 Answer 1

up vote 3 down vote accepted

It could be that you somewhere in your configuration define a Directory outside of DocumentRoot (e.g. I store my static pages under DocumentRoot but have web-applications in a separate directory outside DocumentRoot). By having <Directory /> in your configuration you define a reasonable default that's valid for every directory not specified by an own <Directory>-stanza.

share|improve this answer

Your Answer

 
discard

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.