server { listen 7860; server_name localhost; location / { root /usr/share/nginx/html; index index.html; try_files $uri $uri/ /index.html; } # Explicitly deny access to the .git directory location /.git { deny all; return 404; } # Allow only .html, .js, and .json files; deny everything else with extensions location ~* \.(?!html$|js$|json$)[^./]+$ { deny all; return 403; } }