Hostxpeed
Login Get Started →
Security

How to Disable Directory Browsing

4 min read
28 views
Jun 10, 2026

For Nginx

location / {
autoindex off;
}

Global setting: autoindex off; in nginx.conf is default.

For Apache

Disable via .htaccess or virtual host:

Options -Indexes

For Apache (main config)

sudo nano /etc/apache2/apache2.conf

Change:

<Directory /var/www/>
Options -Indexes
</Directory>

Verify

curl -I http://yourdomain.com/uploads/

Should return 403 Forbidden.

Was this article helpful?