Imagine someone has found a serious vulnerability on your website and wants to tell you. Where should they write? The general address on the contact page goes to sales, the phone number leads to a call centre, and a message on your social media page sits unread for weeks. A security.txt file solves exactly this: it is a plain text file in a standard location that tells people whom to contact about security issues and how.
What the standard says
The format is defined in RFC 9116. The file lives at /.well-known/security.txt and must be served over HTTPS as plain text. Each line is a "Field: value" pair. Only two fields are required: Contact and Expires.
| Field | Required | Purpose |
|---|---|---|
| Contact | Yes, one or more | mailto:, https: or tel: address |
| Expires | Yes, exactly one | Date and time after which the file is stale |
| Policy | No | Vulnerability disclosure policy page |
| Encryption | No | Location of a public key |
| Acknowledgments | No | Thanks page for researchers |
| Preferred-Languages | No | Languages you can read |
| Canonical | No | Official URL of the file |
| Hiring | No | Security job openings |
The standard recommends setting Expires less than a year ahead, so the file gets reviewed regularly and an old address does not linger after staff changes.
Example: a file for an online school
Say a Tashkent online learning centre runs misol.uz, where students register, pay and watch lessons. It has a dedicated security mailbox, a disclosure policy page, and can answer in Uzbek, Russian and English:
Contact: mailto:security@misol.uz
Contact: https://misol.uz/xavfsizlik
Expires: 2027-10-31T23:59:59.000Z
Preferred-Languages: uz, ru, en
Policy: https://misol.uz/xavfsizlik/siyosat
Canonical: https://misol.uz/.well-known/security.txt
Multiple Contact lines are listed in order of preference. The date is in UTC, which the trailing Z indicates. Comment lines start with #.
Placing the file on your hosting
In the site's root folder, create .well-known if it does not exist and put security.txt inside. On sayt.uz hosting you can do this with the file manager of the ISPmanager panel opened from the cabinet, or over SFTP. Do not delete other folders such as acme-challenge, which Let's Encrypt uses. Over SSH:
cd ~/www/misol.uz
mkdir -p .well-known
nano .well-known/security.txt
chmod 644 .well-known/security.txt
The exact path depends on your hosting setup. Save the file as UTF-8 plain text, not as a word-processor document.
Content-Type and the legacy location
Some tools still look for /security.txt at the site root, and the standard allows redirecting it. On Apache, in .htaccess:
RewriteEngine On
RewriteRule ^security\.txt$ /.well-known/security.txt [R=301,L]
<Files "security.txt">
ForceType "text/plain; charset=utf-8"
</Files>
On your own VPS with Nginx:
location = /.well-known/security.txt {
default_type text/plain;
charset utf-8;
}
location = /security.txt {
return 301 /.well-known/security.txt;
}
Then check that you get status 200 with a text/plain content type:
curl -sI https://misol.uz/.well-known/security.txt
This works with WordPress too, since the standard rewrite rules serve existing files directly. If you see the CMS's 404 page, the file is probably in the wrong folder.
Signing and keeping it current
The file may be signed with OpenPGP so readers can verify that nobody, for example an attacker who compromised the site, has replaced the contact address:
gpg --output security.txt --clearsign security.txt.unsigned
gpg --verify security.txt
Signing is optional, but sensible if you publish a key in Encryption. Set a calendar reminder a month before Expires, confirm the addresses still work, and send a test message to the security mailbox once to make sure it reaches the right person. If you run several subdomains, such as a cabinet or an API, add the file there too or redirect to the main one.