nginx: [emerg] cannot load certificate key: BIO_new_file() failed (Permission denied) / open() failed (13: Permission denied)
nginx can't read the private key or certificate file, so it refuses to start or reload.
nginx: [emerg] cannot load certificate key: BIO_new_file() failedBIO_new_file() failed (SSL: error:0200100D:system library:fopen:Permission deniedopen() "/etc/ssl/private/example.key" failed (13: Permission denied)cannot load certificate "/etc/...": BIO_new_file() failednginx ssl key permission denied Meaning
Fix ownership and mode: keys readable by root (nginx master reads them as root, so check parent directory permissions and SELinux/AppArmor contexts too). Don't make keys world-readable. Check the full path (every directory needs x), and symlink targets such as Let's Encrypt's archive/.
Common causes
- Wrong file mode/ownership on the key
- Parent directory not traversable
- SELinux/AppArmor blocking
- Symlink target in
archive/unreadable - Key on a mount with noexec/ACL restrictions
⚡ Quick fix
ls -lalong the path and fix permissionschmod 640andchown root:ssl-cert(or similar)- Check SELinux:
restorecon -Rv /etc/ssl
Detailed fix by platform
Shell
- bash
namei -l /etc/letsencrypt/live/example.com/privkey.pem sudo nginx -t
How to diagnose
- Path — Traversable?
- Mode/owner — Correct?
- SELinux — Blocking?
🔧 Still not fixed?
Many errors look alike. If the steps above didn’t solve it, one of these is probably what you’re facing:
Similar errors
Most viewed in SSL / TLS
- HTTPSConnectionPool: Max retries exceeded (SSLError) Python requests: HTTPSConnectionPool(host='api.example.com', port=443): Max retries exceeded with url: /v1 (Caused by SSLError(SSLCertVerificationError(1, '[SSL: CERTIFICATE_VERIFY_FAILED] ...')))
- DST Root CA X3 expired (old clients fail) Old clients: certificate has expired — Let's Encrypt chain uses expired DST Root CA X3 (OpenSSL 1.0.x, Android < 7.1.1)
- Keystore was tampered with, or password was incorrect Java keytool: java.io.IOException: Keystore was tampered with, or password was incorrect
Other ways to find it
Where this error sits
Origin: Network. Errors that are often confused with or caused by this one (click to open):
🧠 Still stuck? Analyze your error
Paste the full message, response headers or stack trace — we'll detect the platform and point to the most likely cause.
💬 What worked for others
No tips yet — did something else fix this for you?
Share what worked for you
Tips are checked by an editor before they appear. Links are removed.
Report a correction or suggest an improvement
Last updated 18 Nov 2026