How to enable directory listing in Nginx

Enabling the Nginx Directory Index Listing



If you are using Nginx web server and you want to display folder in Nginx by web you need to change "autoindex on; in your conf file", By default we can't open directory from Nginx web. 


Enable Directory listing : Open your nginx conf file and change.


server {
        listen 80 default_server;
        listen [::]:80 default_server;
root /var/www/html;
index index.html index.htm index.nginx-debian.html;
        autoindex on; #for enable directory listing 
        server_name _;

        location / {
  try_files $uri $uri/ =404;
        }

}