HostOnNet Blog

Enable Directory Listing in Nginx

Looking for Linux Server Admin or WordPress Expert? We can help.

To enable directory listing in nginx virtual host, add

autoindex on;

Example

server {
	server_name lab.hosthat.com;
	root /var/www/html;
	listen 80;
	autoindex on;
}

If you want to enable directory listing for a specific directory, use following configuration

server {
	server_name lab.hosthat.com;
	root /var/www/html;
	listen 80;
	location /public {
		autoindex on;
	}
}

Here /public directory have directory listing enabled.

See Nginx

Posted in Nginx

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.