server { listen 80; server_name localhost; root /usr/share/nginx/html; location / { autoindex on; autoindex_exact_size off; autoindex_localtime on; autoindex_format html; # Try files first, then directory listing try_files $uri $uri/ =404; } # Serve index.html if it exists index index.html index.htm; }