Question

I am trying to get my OSX MacPorts install of Apache to NOT show directory listings. I have tried various configurations of the "options" directive in the httpd.conf file with no luck. When I go to the site, it still lists the root directory (there is no index file at the moment.)

Apache has been restarted after each change.

There is no .htaccess file in the / directory, so there shouldn't be anything overriding.

This is driving me crazy!

Était-ce utile?

La solution

So basically something is overriding your config. From the documentation of apache we can read that Options is can be placed in various context: server config, virtual host, directory, .htaccess. httpd.conf is read first, so if You provided the configuration properly there, it means that it is overridden somewhere else

How did You do enter the options in the config ? In the most basic variant it should be.

<Directory /path>
     Options -Indexes
</Directory>

Here what you should do:

  • check module configurations in modules for Options Indexes
  • check the main virtualhost definition, probably called default or 000-default

If it still does not help, add Options -Indexes to your virtualhost directly (provided you have not done it already). Or add it to the .htaccess file in your directory (allowing Options in .htaccess needs to be switched on)[as suggested in comments]

Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top