HostOnNet Blog

Enable Directory Listing in Nginx

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