Apache Disable Directory Browsing Ubntu server

  1. sudo user   to  admin
  2. Open the /etc/apache2/apache2.conf file.
    $ sudo nano /etc/apache2/apache2.conf
    

    Find the content below.

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

    Change the line:

    Options Indexes FollowSymLinks
    

    to:

    Options -Indexes +FollowSymLinks
    

    When finished, it should look like this.

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

3. /etc/init.d/apache2 restart

 

ok work