Nginx & Apache Security Headers Generator
Generate HSTS, X-Frame-Options, Referrer-Policy, Permissions-Policy, and an optional CSP — as Nginx or Apache config, checked against real syntax rules for both.
About this tool
The output was tested on real Nginx 1.30 and Apache 2.4 servers during development, which is how it handles an easy-to-miss gotcha: Nginx's add_header doesn't inherit from a parent block into a nested location block that defines its own add_header lines — you have to repeat them. The CSP section is deliberately the most cautious part of this tool, built from direct experience: a CSP that works fine on a simple page can silently break ads, fonts, or any third-party script the moment you deploy it, so it ships off by default and the presets are intentionally conservative. That applies to this site too: proxyforge.tech sends HSTS, X-Frame-Options, X-Content-Type-Options, Referrer-Policy and Permissions-Policy, but no CSP yet, because its Google ads load scripts from domains that change often and a strict CSP would block them. See How to use ProxyForge for a walkthrough of every setting and where the output goes.
How it works
Pick Nginx or Apache, then toggle the headers you want — HSTS, frame protection, MIME sniffing, referrer policy, permissions.
Optionally enable a CSP preset — read the warning first, since this is the one header that can genuinely break things if misconfigured.
Copy the result into your existing server block — this is a snippet to add alongside your config, not a replacement for it. Then test it (nginx -t or apachectl configtest) before you reload.
Common errors: Reloaded, but the new headers don't show up · nginx -t passes, nothing on port 443
Need to validate your full setup?
Once headers are live, check them for real:
Some links above are affiliate links — signing up through them may earn this site a small commission at no extra cost to you. See the privacy policy for details.