Nginx Security Headers Generator

100% Client-Side Private

Harden web server security with HSTS, CSP, and X-Frame-Options snippets

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.

Get Extension

How to configure Nginx security headers

  1. 1Select the desired security headers (HSTS, CSP, X-Frame-Options).
  2. 2Adjust policy parameters or use hardened defaults.
  3. 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