bch
Member
- bch was last seen:
- Apr 4, 2025
- Loading...
- Loading...
-
About
My Tips & Tricks
1) Disable Apache 2.4 Directory Listings
In Apache 2.4 (on Debian 8), directory listings, also called indexes, are enabled by default. That means that if a folder does not contain a index file, Apache will expose the files and folders of that directory when accessed. This tip shows how disable this behaviour by default on all websites created with ISPConfig, while still give clients the possibility to enable it.
ISPConfig administrators can use the Apache Directives field to do this pr. site like this:
but that is not very smart and we want to disable it on all websites by default.Code:<Directory /var/www/clients/client1/web1/web> Options -Indexes </Directory>
(and by the way I have not been able to use the DOCROOT variable (symlink) in this context).
Instead, we create a Apache config file:
and add these lines:Code:vi /etc/apache2/conf-available/custom.conf
Now, we can enable it by:Code:<Directory /var/www/clients/client*/web*/web> Options -Indexes </Directory>
and disable it by:Code:a2enconf custom
and reload Apache afterwards:Code:a2disconf custom
Clients can get their indexes back by putting:Code:service apache2 reload
in their .htaccess file.Code:Options +Indexes
Interact