When you type a path in the browser to reach your website, if your files are listed on the screen; you should avoid this behavior. It is obviously very insecure. Disabling directory listing in apache is very easy. You just need to know where to edit. Go to file "/etc/apache2/sites-enabled/000-default". Open it with your favorite text editor as root user. Go to /var/www directory block. You will see following lines:
<Directory /var/www/>
Options Indexes FollowSymLinks MultiViews
AllowOverride None
Order allow,deny
allow from all
</Directory>
In the line which starts with 'Options', realize 'Indexes' keywords. It causes directory listing. Remove it. Then, save and quit the file. Restart apache server (sudo service apache2 restart
). And that's it.
Comments
Post a Comment