Skip to content

Instantly share code, notes, and snippets.

@LaurenceJJones
Created November 19, 2025 07:21
Show Gist options
  • Select an option

  • Save LaurenceJJones/ecee30389109a6489154a1ba5a7ca57d to your computer and use it in GitHub Desktop.

Select an option

Save LaurenceJJones/ecee30389109a6489154a1ba5a7ca57d to your computer and use it in GitHub Desktop.
example security.conf
# security headers
add_header X-XSS-Protection "0;" always;
add_header X-Content-Type-Options "nosniff" always;
add_header Referrer-Policy "no-referrer-when-downgrade" always;
add_header Content-Security-Policy "default-src 'self' http: https: ws: wss: data: blob: 'unsafe-inline' 'unsafe-eval'; frame-ancestors 'self';" always;
add_header Permissions-Policy "interest-cohort=()" always;
add_header Strict-Transport-Security "max-age=31536000; includeSubDomains" always;
# . files
location ~ /\.(?!well-known) {
deny all;
}
# security.txt
location /security.txt {
return 301 /.well-known/security.txt;
}
location = /.well-known/security.txt {
add_header Content-Type text/plain;
return 200 'Contact: mailto:[email protected]\nExpires: 2026-01-01T00:00:00.000Z';
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment