Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Cannot disable Directory Listing in httpd.conf

I just installed XAMPP on my personal CentOS box and when I try to disable Directory Listing I get an Apache error when restarting. My httpd.conf file looks like this after I make the changes:

httpd.conf

Alias /bitnami/ "/opt/lampp/apache2/htdocs/"
Alias /bitnami "/opt/lampp/apache2/htdocs"

<Directory "/opt/lampp/apache2/htdocs">
    Options -Indexes FollowSymLinks
    AllowOverride All
    Order allow,deny
    Allow from all
</Directory>

Error

XAMPP: Starting Apache...fail.
AH00526: Syntax error on line 5 of /opt/lampp/apache2/conf/httpd.conf:
Either all Options must start with + or -, or no Option may.

I have tried removing Indexes all together and I can still see my directories. Maybe I'm in the wrong file, but from what I've read disabling directory listing has to be made here or .htacces (which I am trying to avoid.) In case it comes up I have made sure to restart XAMPP every time I made changes.

like image 340
Mike Avatar asked Aug 29 '13 17:08

Mike


2 Answers

The error message is pretty clear. To rephrase / show examples:

# relative to whatever lower precedence section applies
Options -Indexes

If your goal is to turn off indexes. If you want to make sure FollowSymlinks is also set, put a + in front of it:

# relative to whatever lower precedence section applies
Options -Indexes +FollowSymlinks

If you want to turn everything but FollowSymlinks off:

# not relative
Options FollowSymlinks
like image 120
covener Avatar answered Sep 21 '22 05:09

covener


Please go to file: /opt/lampp/etc/httpd.conf and either comment the line like this:

#Options Indexes FollowSymLinks Includes ExecCGI

or edit like this

Options -Index

For Windows machine: Do same editing in file /apache/conf/httpd.conf

like image 41
Om Sao Avatar answered Sep 22 '22 05:09

Om Sao