Fix an incomplete or untrusted certificate
Complete the chain.
Your certificate must arrive with the in-between certificate that links it to a public authority. Without it, some phones and apps refuse to connect. A self-signed certificate is refused by everyone.
Before you start
- Whoever runs your server or hosting can do this. Send them this page.
- Copy the settings file to another folder, such as your home folder, before you change it. Putting it back is the way to undo this.
- Download the full chain from the company that issued your certificate. If the certificate is self-signed, get a free one first, using the guide to renewing.
The steps
With Certbot, use fullchain.pem, never cert.pem. With your own files, join them with your certificate first.
ssl_certificate /etc/letsencrypt/live/example.com/fullchain.pem;
ssl_certificate_key /etc/letsencrypt/live/example.com/privkey.pem;Then check the settings and reload.
sudo nginx -t && sudo nginx -s reloadIf it shows an error, or the site stops, put the saved copy back and restart the server program at once.
Apache 2.4.8 or newer reads the whole chain from one file. Delete any SSLCertificateChainFile line.
SSLCertificateFile /etc/letsencrypt/live/example.com/fullchain.pem
SSLCertificateKeyFile /etc/letsencrypt/live/example.com/privkey.pemThen check the settings and reload.
sudo apachectl configtest && sudo apachectl gracefulIf it shows an error, or the site stops, put the saved copy back and restart the server program at once.
One file holds your certificate, then the in-between certificate, then the key. The path must match the crt setting.
sudo sh -c 'umask 077; mkdir -p /etc/haproxy/certs; cd /etc/letsencrypt/live/example.com && cat fullchain.pem privkey.pem > /etc/haproxy/certs/example.com.pem'Then check the settings and reload.
sudo haproxy -c -f /etc/haproxy/haproxy.cfg && sudo systemctl reload haproxyIf it shows an error, or the site stops, put the saved copy back and restart the server program at once.
Delete any tls line that names your own files, and Caddy gets a complete certificate by itself.
Then check the settings and reload.
sudo systemctl reload caddyIf it shows an error, or the site stops, put the saved copy back and restart the server program at once.
Run mmc, add the Certificates snap-in for the Computer account, and import the in-between certificate into Intermediate Certification Authorities.
An Origin certificate works only through Cloudflare. Set the DNS record to Proxied, or install a public certificate on your server.
Import the certificate again. Paste the in-between certificate in the chain box, without your own certificate.
Open SSL/TLS, manage the site, and choose Autofill by Domain. It adds the missing part, the CA Bundle.
The simplest fix is to issue the free Let's Encrypt certificate under SSL/TLS Certificates.
Check that it worked
openssl s_client -connect example.com:443 -servername example.com </dev/null 2>/dev/null | grep "Verify return"The answer should be 0 (ok). 21 means a part is missing. 18 or 20 means the certificate is not from a trusted authority.
To undo it
Put the saved copy of the settings back, then check and reload again.
Common mistakes
- Joining the files in the wrong order. Your own certificate always comes first.
- Trusting your own browser. It may have filled the gap from memory, while a new visitor's phone cannot.