Security Header Directives
Generated Nginx Directives
# ======================================================== # Nginx Hardened HTTP Security Headers # Generated by MiniToolDesk - 100% Client-Side Generator # ======================================================== # Hide Nginx version from Server HTTP response header server_tokens off; # HTTP Strict Transport Security (HSTS) add_header Strict-Transport-Security "max-age=31536000; includeSubDomains; preload" always; # Prevent Clickjacking add_header X-Frame-Options "SAMEORIGIN" always; # Prevent MIME-type sniffing add_header X-Content-Type-Options "nosniff" always; # Legacy XSS Filter protection for older browsers add_header X-XSS-Protection "1; mode=block" always; # Control how much referrer information is sent add_header Referrer-Policy "strict-origin-when-cross-origin" always; # Disable risky hardware & geolocation browser features add_header Permissions-Policy "camera=(), microphone=(), geolocation=(), payment=()" always; # Content Security Policy (CSP) add_header Content-Security-Policy "default-src 'self'; script-src 'self' 'unsafe-inline' https:; style-src 'self' 'unsafe-inline'; img-src 'self' data: https:; object-src 'none'; base-uri 'self';" always;
Pin this tool to your browser side panel
Access this utility anytime with Alt+M without switching tabs. 100% offline & free.
How to configure Nginx security headers
- 1Select the desired security headers (HSTS, CSP, X-Frame-Options).
- 2Adjust policy parameters or use hardened defaults.
- 3Copy directives into your Nginx server block and reload.
OWASP Security Compliance
Enforces HTTPS, blocks iframe framing, and neutralizes malicious script injections.
Frequently Asked Questions
Enjoying Nginx Security Headers Generator?Help your engineering peers discover private, ad-free tools!
MiniToolDesk is 100% free and client-side. Your support keeps the web ad-free.
Related Developer Utilities
Popular
Docker Run to Compose Converter
Convert complex docker run CLI commands into clean, production-ready docker-compose.yml files
Launch toolβ
Popular
Nginx Config Generator
Visual builder for production-ready Nginx reverse proxy, SSL, and SPA configs
Launch toolβ
Popular
Dockerfile Multi-Stage Generator
Visual builder for security-hardened, multi-stage Dockerfiles across modern stacks
Launch toolβ
Popular
Kubernetes YAML Manifest Builder
Visual generator for Deployment, Service, Ingress, and ConfigMap manifests
Launch toolβ