Interview Prep/Networking/TLS and certificate errors

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.

All Networking questions Roadmap: Networking for DevOps

More on TLS and certificate errors