Nginx: [emerg] SSL_CTX_set_tmp_dh("/etc/ssl/dhparam.pem") failed (SSL: error:1401E0A8:SSL routines:... dh key too small)
The Diffie-Hellman parameters file is too weak (e.g. 512 or 768 bit) for the current OpenSSL security level.
SSL_CTX_set_tmp_dh failed dh key too small[emerg] SSL_CTX_set_tmp_dh failed (SSL: error:1401E0A8:SSL routines:SSL_CTX_set_tmp_dh:dh key too small)dh key too smallSSL_CTX_set_tmp_dh failed Meaning
Modern OpenSSL refuses small DH parameters. Generate a new 2048-bit (or larger) file with openssl dhparam -out dhparam.pem 2048, or use ECDHE-only ciphers and remove ssl_dhparam. Old copy-pasted guides sometimes ship a 1024-bit file.
Common causes
- Old weak dhparam.pem file
- Copied dhparam from an outdated tutorial
- OpenSSL security level raised
- Client Java 7 limitations when raising to 4096
- Wrong file path
⚡ Quick fix
openssl dhparam -out /etc/ssl/dhparam.pem 2048- Reference it:
ssl_dhparam /etc/ssl/dhparam.pem; - Or drop DHE ciphers and use ECDHE only
Detailed fix by platform
Nginx
sudo openssl dhparam -out /etc/nginx/dhparam.pem 2048 && sudo nginx -t && sudo systemctl reload nginx
How to diagnose
- Bits — Current dhparam size?
- Config — ssl_dhparam path?
- Ciphers — ECDHE only?
🔧 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
- AH01909: server certificate does NOT include an ID which matches the server name Apache: [ssl:warn] AH01909: example.com:443:0 server certificate does NOT include an ID which matches the server name
- bind() failed (98: Address already in use) nginx: [emerg] bind() to 0.0.0.0:80 failed (98: Address already in use)
- ca md too weak / ee key too small OpenSSL: error:0A00018E:SSL routines::ca md too weak / error:140AB18F:SSL routines:SSL_CTX_use_certificate:ee key too small
Most viewed in SSL / TLS
- NET::ERR_CERT_COMMON_NAME_INVALID NET::ERR_CERT_COMMON_NAME_INVALID: Your connection is not private (certificate is for a different domain)
- Challenge failed for domain Let’s Encrypt / Certbot: Challenge failed for domain example.com — Invalid response from http://example.com/.well-known/acme-challenge/x: 404
- no start line OpenSSL: unable to load certificate / PEM routines:get_name:no start line (key values mismatch)
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 4 Nov 2026