2

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 ?

2
  • What if you visit deve:8009/images ?
    – derobert
    Sep 13, 2009 at 3:49
  • 1
    Your ServerName should probably not have the :8009 portion, just the actual name.
    – Marcin
    Sep 13, 2009 at 3:51

1 Answer 1

8

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>

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .