Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

Plaese till me what is the difference between DocumentRoot and Directory in default file default file in apache2 has three blocks

DocumentRoot /var/www   in me server /sda1/htdocs

<Directory />
    Options FollowSymLinks
    AllowOverride None
</Directory>

<Directory /var/www>   in my server sda1/htdocs>
    Options Indexes FollowSymLinks MultiViews
    AllowOverride None
    Order allow,deny
    allow from all
</Directory>

May I use just these two in sda1/htdocs directory

DocumentRoot /sda1/htdocs

<Directory /sda1/htdocs>
    Options Indexes FollowSymLinks MultiViews
    AllowOverride None
    Order allow,deny
    allow from all
</Directory>

With many Thanks

share|improve this question
add comment

1 Answer 1

Here's an excerpt from the official Apache documentation:

If multiple (non-regular expression) Directory sections match the directory (or one of its parents) containing a document, then the directives are applied in the order of shortest match first, interspersed with the directives from the .htaccess files. For example, with

<Directory /> AllowOverride None </Directory>

<Directory /home> AllowOverride FileInfo </Directory>

for access to the document /home/web/dir/doc.html the steps are:

Apply directive AllowOverride None (disabling .htaccess files).
Apply directive AllowOverride FileInfo (for directory /home).
Apply any FileInfo directives in /home/.htaccess, /home/web/.htaccess and /home/web/dir/.htaccess in that order.

I.e. Directory / directive defines "defaults" for all other directories, which can be overridden by each particular directory

In your case both of the versions you're showing should be equivalent unless you have other Directory directives.

share|improve this answer
    
Many Thanks and Best Wishes to Sergey –  laith1952 Feb 10 '12 at 19:41
add comment

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.