server { listen 80; listen [::]:80; server_name localhost; location / { root /usr/share/nginx/html; index index.html index.htm; try_files $uri $uri.html $uri/ =404; } location ~ /\.git { deny all; access_log off; log_not_found off; } # Custom 404 page error_page 404 /404.html; location = /404.html { } }