SSL_CTX_use_PrivateKey_file failed (key values mismatch) SSL / TLS Origin: Network Last updated 4 Nov 2026

Nginx: [emerg] SSL_CTX_use_PrivateKey_file("/etc/ssl/server.key") failed (SSL: error:0B080074:x509 certificate routines:X509_check_private_key:key values mismatch)

The private key does not belong to the certificate configured in the server.

Exact message you may see key values mismatchSSL_CTX_use_PrivateKey_file failed (SSL: error:0B080074:x509 certificate routines:X509_check_private_key:key values mismatch)X509_check_private_key:key values mismatchSSL: error:140A1175:SSL routines:SSL_CTX_use_PrivateKey:... key values mismatchprivate key does not match the certificate
Seen on: SSL Nginx Linux

Meaning

Compare the public-key modulus of cert and key: they must be identical. Typical causes are pairing a new certificate with an old key, mixing keys from different CSRs, or pointing ssl_certificate at the wrong file. Reissue or use the key that generated the CSR.

Common causes

  • Certificate renewed but old private key used
  • Wrong files referenced (staging vs production)
  • Key generated for a different CSR
  • Certificate chain file used instead of leaf first
  • Multiple domains' files mixed

⚡ Quick fix

  1. Compare hashes: openssl x509 -noout -modulus -in cert.pem | md5sum and openssl rsa -noout -modulus -in key.pem | md5sum
  2. Use the key that matches the certificate
  3. Regenerate CSR and certificate if the key is lost

Detailed fix by platform

Linux

  1. For EC keys compare: openssl x509 -noout -pubkey -in cert.pem | md5sum; openssl pkey -pubout -in key.pem | md5sum

How to diagnose

  1. Hashes — Equal?
  2. Files — Right paths?
  3. Order — Leaf first in the cert file?

🔧 Still not fixed?

Many errors look alike. If the steps above didn’t solve it, one of these is probably what you’re facing:

Where this error sits

Origin: Network. Errors that are often confused with or caused by this one (click to open):

bind() failed (98: Address already in use) — nginx: [emerg] bind() to 0.0.0.0:80 failed (98: Address already in use) (Linux)bind() failed (98: Ad…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 (SSL / TLS)ca md too weak / ee k…Could not automatically find a matching server block — Certbot: Could not automatically find a matching server block for example.com. Set the `server_name` directive to use the Nginx installer (SSL / TLS)Could not automatical…ERR_SSL_KEY_USAGE_INCOMPATIBLE — Chrome: ERR_SSL_KEY_USAGE_INCOMPATIBLE — the certificate's key usage doesn't allow the negotiated cipher (SSL / TLS)ERR_SSL_KEY_USAGE_INC…incomplete certificate chain — SSL Labs: Chain issues: Incomplete — Extra download (intermediate certificate missing) (SSL / TLS)incomplete certificat…MySQL: SSL connection error: SSL is required but the server doesn't support it — MySQL: ERROR 2026 (HY000): SSL connection error: SSL is required but the server doesn't support it (SSL / TLS)MySQL: SSL connection…nginx: [emerg] unknown directive — Nginx: nginx: [emerg] unknown directive "x" in /etc/nginx/sites-enabled/x:12 — configuration file test failed (Nginx / Apache)nginx: [emerg] unknow…no "ssl_certificate" is defined for the "listen ... ssl" directive — Nginx: [emerg] no "ssl_certificate" is defined for the "listen ... ssl" directive in /etc/nginx/sites-enabled/default:3 (SSL / TLS)no "ssl_certificate" …SSL_CTX_u…

Explore the map of this error Full error map →

🧠 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.