Security nginx Intermediate

Nginx Security Headers

Production-ready Nginx config block with HSTS, CSP, X-Frame-Options and more.

nginx
add_header Strict-Transport-Security "max-age=63072000; includeSubDomains; preload" always;
add_header X-Frame-Options "SAMEORIGIN" always;
add_header X-Content-Type-Options "nosniff" always;
add_header Referrer-Policy "strict-origin-when-cross-origin" always;
add_header Permissions-Policy "camera=(), microphone=(), geolocation=()" always;

Prerequisites

  • Nginx >= 1.18

Pro Tips

  • → Test CSP with report-only first before enforcing.
  • → Use securityheaders.com to validate.

Was this module useful?

Share your experience — it helps the team improve.

Leave Feedback

Commercial Licensing

Acquire a production access token or template license for enterprise deployment.

Module Info

Language
nginx
Level
Intermediate
Read time
3 min
Published
Jan 2025
License
Commercial License

Newsletter

New modules every week, directly to your inbox.