Disable Apache directory indexes

How can I disable directory indexing by apache ?
It is unsafe.

I’ve added an .htaccess file “Options -Indexes” in the directory but it not work.
I’ve edited the conf.d and removed the Options -Indexes…
I’ve restarted apache many times but still indexig the root.
There are many conf file to edit ?

I think that using an .htaccess fileis the correct way, but you have to enable it (last option in the web access folder of the shared folder).

I’m using nethserver 6.5 i haven’t the option to enable override of .htaccess.

Which file i have to edit to do enable .htaccess manually ?

Which httpd.conf file are you modifying? There is the “standard” one for apache and then their is NethServer’s httpd.conf file located in /etc/httpd/admin-conf. Line 184 at the bottom of the config shows ‘Options +Indexes’.

<Directory /var/lib/nethserver/winregistry-patches/>
       Options +Indexes
       Order Allow,Deny
       Allow from all
</Directory>

Include conf.d/php.conf

This file is also generated from templates which you would also have to update. Any changes made to NethServer (not sure which ones explicitly) will revert the changes you made to the config file. The templates for this config file is located at ‘/etc/e-smith/templates/etc/httpd/admin-conf/httpd.conf’; and there are two files that you need to update named ‘60NethServerManager’ and ‘60winregistry_patches’.

I’ve edited the standard apache conf file located in /etc/httpd/conf/httpd.conf…

My DocumentRoot is a shared folder selected in the nethserver interface.

I think that can be enough for my uses inserting the instruction “AllowOverride All” that allow to use .htaccess file