When Apache Directory Index is enabled, if you browse to a url that have no index file present, you will see list of all files. This is not good for securiy as hackers can see all files present in the directory.
One way to disable this directory listing is create a file with name index.html or index.php (whatever file name that is specified in Apache DirectoryIndex) with no content.
Another solution is to disable directory indexing for the web site in Apache virtual host configuration, for this, under Here is an example apache configuration file Directory listing is generated by apache module mod_autoindex. You can disable this module to disable directory listing generation On Ubuntu/Debian See Apache
Method 2: disable autoindex module
a2dismod autoindex -f
systemctl restart apache2
Leave a Reply