For Nginx
location / {
autoindex off;
}Global setting: autoindex off; in nginx.conf is default.
For Apache
Disable via .htaccess or virtual host:
Options -IndexesFor Apache (main config)
sudo nano /etc/apache2/apache2.confChange:
<Directory /var/www/>
Options -Indexes
</Directory>Verify
curl -I http://yourdomain.com/uploads/Should return 403 Forbidden.