Maaz Zindani

Loading the index…

↑↓ move↵ openesc close4072 pages
Servers, nginx and Docker

The site looks fine in a browser but its SSL chain is incomplete

ErrorIs this SSL certificate chain broken?

Short answer

Browsers often keep intermediate certificates they saw before, so a site without its bundle can look fine in them and still fail for other clients. Check with openssl s_client: if only certificate 0 appears, the bundle is missing. Append the intermediates to the server certificate file.

  • Applies to nginx 1.26, OpenSSL 3.0, Ubuntu 24.04
  • Updated
  • By Maaz Zindani, Senior Software Engineer

Fix it fast

  1. 1Find out which cause you have

    List the certificates the server really sends. A complete setup shows your certificate at depth 0 followed by at least one intermediate.

    openssl s_client -connect example.com:443 -servername example.com -showcerts </dev/null
  2. 2Match what you see, then jump to its fix

    1. 1The s_client output lists only certificate #0.The intermediate bundle was never added to the certificate fileFix
    2. 2ssl_stapling_verify is on and the stapled answer is missing, while the served chain is complete.OCSP stapling cannot verify the chainFix

What does the error look like?

  • Is this SSL certificate chain broken?
  • The site works in a browser but fails in another client or checker

Cause 1 of 2

The intermediate bundle was never added to the certificate file

1Check

Count the BEGIN CERTIFICATE blocks in the file passed to ssl_certificate.

grep -c "BEGIN CERTIFICATE" /etc/nginx/ssl/example.com.crt

2Fix

Concatenate your certificate and the bundle your authority sent, certificate first, and use the result in ssl_certificate.

cat example.com.crt bundle.crt > example.com.chained.crt
# in the server block:
# ssl_certificate     /etc/nginx/ssl/example.com.chained.crt;
# ssl_certificate_key /etc/nginx/ssl/example.com.key;

3Verify

Reload, then run the first-step command again and see more than one certificate.

sudo nginx -t && sudo systemctl reload nginx
openssl s_client -connect example.com:443 -servername example.com -showcerts </dev/null | grep -c "BEGIN CERTIFICATE"

Confirmed by nginx.org

Did this fix it?

Cause 2 of 2

OCSP stapling cannot verify the chain

1Check

ssl_trusted_certificate holds the CA certificates used to verify OCSP responses when stapling is enabled; with ssl_stapling_verify the root and the intermediates must be in it.

grep -R -n -E "ssl_stapling|ssl_trusted_certificate" /etc/nginx/

2Fix

Add the file with the root and intermediate certificates.

ssl_stapling on;
ssl_stapling_verify on;
ssl_trusted_certificate /etc/nginx/ssl/ca-chain.pem;

3Verify

Reload nginx without errors and ask for the stapled response.

sudo nginx -t && sudo systemctl reload nginx
openssl s_client -connect example.com:443 -servername example.com -status </dev/null | grep -i -A3 "OCSP"

Confirmed by nginx.org

Did this fix it?

How do I stop it coming back?

  • Test with openssl s_client after every renewal, not only in your own browser.
  • Build the chained file by a script, with your certificate first.
  • Keep the authority's bundle next to the certificate it came with.

Sources

How was this page made?

I drafted this page with AI assistance from the official documents listed under Sources. Every cause above names the document that confirms it. I have not reproduced this fix on a machine of my own yet, so read it as documented guidance, not a test report. Found a mistake? Tell me.

Which stack is behind this page?

Projects of mine built on the same technologies:

Related fixes

Next step

Want this handled for good?

I look after servers, apps and releases end to end. Tell me what keeps breaking.