server { listen 8081; server_name localhost; server_tokens off; root /usr/share/nginx/html; # Compression gzip on; gzip_types text/css application/javascript application/json image/svg+xml; # Security headers add_header X-Content-Type-Options "nosniff" always; add_header Referrer-Policy "strict-origin-when-cross-origin" always; # Never serve dotfiles (.git, .dockerignore, ...) location ~ /\. { deny all; } # Images and PDFs rarely change. HTML, JS, CSS and JSON are not fingerprinted, # so they keep nginx's default (ETag / Last-Modified revalidation). location ~* \.(jpg|png|pdf)$ { expires 30d; } }