PKI & Certificates
10 min read • Updated: 2026-11-20

Diagnosing and Fixing Common TLS/SSL Handshake & Certificate Chain Errors in Production

A practical troubleshooting handbook for Nginx, Apache, and client-side SSL errors like incomplete chains and expired dates.

Authored by WONTERA Engineering • Verified Standards

TLS handshake failures disrupt user traffic and trigger immediate browser security warnings. Because TLS terminates at the transport layer before any application code executes, diagnosing these errors requires understanding how web servers and clients assemble the certificate trust chain.

1. Top Production SSL Errors & Root Causes

Error Code / Message Root Cause Remediation
X509_V_ERR_UNABLE_TO_GET_ISSUER_CERT_LOCALLY
Missing Intermediate
The web server only sent its Leaf certificate and omitted the Intermediate CA bundle. Desktop browsers often cache intermediate CAs, but curl, mobile apps, and API gateways will fail immediately. Concatenate the Leaf certificate and the Intermediate CA into a single fullchain.pem file. Configure your server to serve the full chain.
ERR_CERT_COMMON_NAME_INVALID
Domain Mismatch
The requested domain name is missing from the certificate's Subject Alternative Name (SAN) extension. Reissue the certificate ensuring all domain variants (e.g., example.com and www.example.com) are explicitly specified in the SAN list.
ERR_CERT_DATE_INVALID / SEC_ERROR_EXPIRED_CERTIFICATE The certificate's validity window (notAfter) has elapsed, or server/client system clocks suffer from severe clock skew. Renew certificate or synchronize system clocks using NTP (chrony or systemd-timesyncd).
SSL: error:0B080074:key values mismatch The configured private key does not correspond to the public key embedded inside the certificate. Verify modulus hashes with OpenSSL or WONTERA's Key Matcher tool to pair the correct private key.

2. How to Properly Assemble fullchain.pem

When a Certificate Authority delivers your certificates, they usually provide two files:

  • domain.crt (Your Leaf end-entity certificate)
  • ca-bundle.crt (One or more Intermediate CA certificates)

The order of certificates in the combined bundle is strictly defined:

# Proper concatenation order: Leaf first, then Intermediate CAs:
cat domain.crt ca-bundle.crt > fullchain.pem

If you reverse the order (putting the Intermediate CA first), Nginx will attempt to present the Intermediate CA as the server identity, causing immediate handshake failures.

3. Diagnosing Handshakes with OpenSSL s_client

The most powerful command-line utility for debugging live TLS handshakes is openssl s_client:

# Test TLS connection and inspect certificate chain sent by the server:
openssl s_client -connect example.com:443 -servername example.com -showcerts

Look for the Certificate chain section in the output:

Certificate chain
 0 s:CN = example.com
   i:C = US, O = Let's Encrypt, CN = R3
 1 s:C = US, O = Let's Encrypt, CN = R3
   i:C = US, O = Internet Security Research Group, CN = ISRG Root X1

If you only see level 0 and level 1 is absent, your server is misconfigured and failing to send intermediate authority certificates.

Interactive Tool

Put This Guide into Practice

Test your certificates, keys, or tokens in-memory with our zero-disk developer tool.

Open X.509 Certificate Decoder & Classifier