webzod
account

Publish a security.txt file on nginx

hygiene.security_txt.missing · effort: minutes

Why it matters

A security.txt file tells researchers who to contact when they find a security problem on your site, so a report reaches you instead of being posted publicly or lost. It is a small plain text file defined in RFC 9116.

The fix

  1. Create the file at /var/www/security/.well-known/security.txt with the content shown in the generic tab (any directory works; adjust the root below).
  2. Add the location block inside the server block for example.com. An exact-match location wins over a regex rule that denies dotfiles, so it also works if you block paths starting with a dot.
  3. Run nginx -t, then reload nginx. Browse to https://example.com/.well-known/security.txt and check the content type is text/plain with charset=utf-8.
/etc/nginx/conf.d/example.com.conf
location = /.well-known/security.txt {
    root /var/www/security;
    default_type text/plain;
    charset utf-8;
}

The examples use example.com. Replace it with your own domain.

Read the documentation (opens in a new tab)

Scan your domain to see whether this applies to you.