After a key rotation, nginx refuses to start: `SSL_CTX_use_PrivateKey ... key values mismatch`.
IntermediateTroubleshootingTLS and certificate errors
Answer
Likely causes → The new certificate was paired with the old key, or the files were swapped.
Diagnose →
openssl x509 -noout -pubkey -in cert.pem | sha256sum
openssl pkey -pubout -in key.pem | sha256sum # hashes must match
Fix → Pair the matching key and cert, nginx -t, then reload.
Prevent → Validate key/cert pairs in the deployment pipeline before pushing.
More on TLS and certificate errors
`curl: (60) SSL certificate problem: certificate has expired`Beginner`curl: (60) SSL certificate problem: unable to get local issuer certificate`Beginner`SSL: no alternative certificate subject name matches target host name 'api.example.com'`BeginnerSome clients get the wrong certificate (another site's) from a shared IP.Intermediate`SSL routines::sslv3 alert handshake failure` from `openssl` or curl.IntermediatePython `requests` fails with `SSLError: [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: self-signed certificate in certificate chain`.Beginner