Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

Into the original httpd.conf, I have

Options Indexes FollowSymLinks

I created a config file in /etc/httpd/conf.d/ with

NameVirtualHost 192.168.0.2:8009
<VirtualHost  192.168.0.2:8009>
    DocumentRoot /var/www/html/deve
    ServerName "deve:8009"
    ErrorLog /var/www/deve_errorlog
    CustomLog /var/www/deve_customlog common
    Options -ExecCGI -Indexes
</VirtualHost>

I restart the server and I still can see files in

http://192.168.0.2:8009/images

I tought that the more specific rule overides the general one

Where do I miss something ?

share|improve this question
    
What if you visit deve:8009/images ? –  derobert Sep 13 '09 at 3:49
    
Your ServerName should probably not have the :8009 portion, just the actual name. –  Marcin Sep 13 '09 at 3:51

2 Answers 2

up vote 8 down vote accepted

You are basically correct, however missing a subtlety in the use of Options.

First, however, don't just stick them in the NameVirtualHost container, use a Directory Statement...

You are correct that the most specific ones apply, however, if an options statement contains a list of options where every one is prefixed with a + or -, then the options are merged with any existing options...

This means

Options Indexes FollowSymLinks

is merged with

Options -ExecCGI -Indexes

to form

Options Indexes FollowSymLinks -ExecCGI

Have a look at the apache documentation http://httpd.apache.org/docs/2.2/mod/core.html

and specifically at the example:

...if the second Options directive uses the + and - symbols:

<Directory /web/docs>
   Options Indexes FollowSymLinks
</Directory>

<Directory /web/docs/spec>
   Options +Includes -Indexes
</Directory>

then the options FollowSymLinks and Includes are set for the /web/docs/spec directory.

Hence, the behaviour Apache is exhibiting with your configuration is correct.

I would just explicitly declare the options for the NameVirtualHost as follows:

<Directory /var/www/html/deve>
  Options +FollowSymlinks -Indexes -ExecCGI
</Directory>
share|improve this answer

Hey @ColtonCat, I have a question about your answer. Why did you think Indexes FollowSymLinks merging with -ExecCGI -Indexes forms Indexes FollowSymLinks -ExecCGI? Shouldn't it be FollowSymLinks -ExecCGI. The example from Apache doc seems working in that way, i.e. -Indexes in /web/docs/spec removes Indexes in /web/docs. Did I miss anything here? Do you think the actual culprit is that Options should be put into "Directory" directives? (I'm sorry that I had to write this as an answer because I cannot post comment yet)

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.