Skip to content

Disable directory listing in Apache with Debian

by on August 25, 2010

If you find one of your servers with the ugly directory listing enabled, there’s a quick way to disable it in Debian

# echo autoindex | a2dismod
# /etc/init.d/apache2 restart

For other Apache installations in other distro, you can simple find the Autoindex option in your config file and delete it manually, then restart Apache

EDIT: a cleaner and more elegant way to achieve the same is, as the comments section says

# a2dismod autoindex

thanks :)

3 Comments
  1. a2dismod autoindex
    this also work

    Also -Indexes in the Directory or Location Directives in the vHost config o General config

  2. Rob permalink

    a2dismod autoindex
    apache2ctl graceful

    Shorter and cleaner imho :>

  3. Ok, a2dismod autoindex is better than the echo/pipe solution, you’re right :). But I do not agree on the apache2ctl, I always prefer the init.d script to reload conf/restart services, even if it’s a little more verbose

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Connecting to %s

Follow

Get every new post delivered to your Inbox.