Disable browsing directories by default

Discussion in 'ISPConfig 3 Priority Support' started by MaxT, Mar 29, 2019.

  1. MaxT

    MaxT Member HowtoForge Supporter

    Is there some way to apply -Indexes inside ISPC or /etc/apache2 for all the sites?

    I tried this inside /etc/apache2/apache2.conf but thinking it was an atrocity and yes apache don't like it:
    Code:
    <Directory /var/www/*/web/>
            Options -Indexes FollowSymLinks
            AllowOverride None
            Require all granted
    </Directory>
    
     
    Last edited: Mar 29, 2019
  2. till

    till Super Moderator Staff Member ISPConfig Developer

    This is not defined by ISPConfig, so you will find it in one of the global apache files. Use the command:

    grep -n Indexes /etc/apache2/apache2.conf

    to find where the Indexes setting is defined globally and change it there. If its not in apache2.conf, then you can search for it globally with:

    grep -rn Indexes /etc/apache2/
     
    MaxT likes this.
  3. MaxT

    MaxT Member HowtoForge Supporter

    sorry, it was just a syntax error.. I forget when using "-" then rest of options needs "+".
    So writing "Options -Indexes FollowSymLinks" breaks apache. It should be:
    Code:
    <Directory /var/www/>
            Options -Indexes +FollowSymLinks
            AllowOverride None
            Require all granted
    </Directory>
    
    and then also adding below the first idea it works, without need to touch the previous section:
    Code:
    <Directory /var/www/*/web/>
            Options -Indexes +FollowSymLinks
            AllowOverride None
            Require all granted
    </Directory>
    
    good to know.

    edit: it doesn't work. It seems the first one is mandatory over the second one.

    Thanks anyway!
     
    Last edited: Mar 29, 2019

Share This Page