Sei sulla pagina 1di 1

How to disable directory

browsing in apache
configuration?
Home > Post Affiliate Pro > Frequently asked
questions > General questions > How to disable directory
browsing in apache configuration?
One of the “must do’s” on setting a secure apache web server is to disable directory browsing.

Usually apache comes with this feature enabled but its always a good idea to get it disabled unless you really need it.

First of all find where is the main apache’s config file apache2.conf is located.

Usually it will be located in path like this: /etc/apache2/apache2.conf.

To edit this file you will need root access to your server.
$sudo -i

Using some file editor like Vim or Nano open this file and find the line that looks as follows:

<Directory /var/www/>
Options Indexes FollowSymLinks
AllowOverride None
Require all granted
</Directory>

then remove word Indexes and save the file. The line should look like this one:
<Directory /var/www/>
Options FollowSymLinks
AllowOverride None
Require all granted
</Directory>

After it is done, restart apache (e.g. systemctl restart apache2).


That’s it!

Potrebbero piacerti anche