bch
Last Activity:
Nov 8, 2022
Joined:
Feb 26, 2013
Messages:
49
Likes Received:
7
Trophy Points:
8

Share This Page

bch

Member

bch was last seen:
Nov 8, 2022
    1. There are no messages on bch's profile yet.
  • 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:
    Code:
    <Directory /var/www/clients/client1/web1/web>
        Options -Indexes
    </Directory>
    
    but that is not very smart and we want to disable it on all websites by default.
    (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:
    Code:
    vi /etc/apache2/conf-available/custom.conf
    and add these lines:
    Code:
    <Directory /var/www/clients/client*/web*/web>
        Options -Indexes
    </Directory>
    
    Now, we can enable it by:
    Code:
    a2enconf custom
    
    and disable it by:
    Code:
    a2disconf custom
    
    and reload Apache afterwards:
    Code:
    service apache2 reload
    
    Clients can get their indexes back by putting:
    Code:
    Options +Indexes
    
    in their .htaccess file.