LogCure.com
Server Error

Fixing "SSL Handshake Failed" Errors on Fresh Server Deployments

Why Do SSL Handshakes Fail on New Servers?

SSL handshake failures on fresh deployments occur when the client and server cannot negotiate a shared TLS version and cipher suite, when the certificate chain is incomplete (missing intermediate CAs), when port 443 is blocked by a firewall rule, or when the server clock is significantly out of sync — causing certificate validity timestamps to be rejected by the client's TLS library.

Quick Diagnostic Table

Error MessageCauseFix
SSL handshake failed / ERR_SSL_PROTOCOL_ERRORTLS version mismatchEnable TLS 1.2 and 1.3 on server
SSL certificate verify failedMissing intermediate CA certInclude full chain in cert bundle
Connection refused on :443Port 443 blocked by firewallOpen port 443 in UFW/iptables
Certificate has expiredCert not renewedRun certbot renew
Self-signed cert warningLet's Encrypt not configuredIssue cert via Certbot

How to Fix SSL Handshake Failures

Fix 1 — Diagnose with OpenSSL

Run this command to see the full handshake and certificate chain: openssl s_client -connect yourdomain.com:443 -servername yourdomain.com. Look for "Verify return code: 0 (ok)" — anything else identifies the problem.

Fix 2 — Fix the Certificate Chain

Your SSL certificate file must include the full chain. When using Certbot, use fullchain.pem not cert.pem. In your Nginx config:

Fix 3 — Open Port 443

  1. Check if port 443 is listening: sudo ss -tlnp | grep 443
  2. Open in UFW: sudo ufw allow 443/tcp && sudo ufw reload
  3. Open in iptables: sudo iptables -A INPUT -p tcp --dport 443 -j ACCEPT

Fix 4 — Update Cipher Suite Configuration

In your Nginx config (/etc/nginx/nginx.conf), set modern TLS settings:

Fix 5 — Reissue Certificate with Certbot

If your certificate is self-signed, expired, or missing, reissue it: sudo certbot --nginx -d yourdomain.com -d www.yourdomain.com. Certbot automatically configures Nginx with the correct cert paths and reloads the server.

Verification

✓ How to Confirm the Fix Worked

Run openssl s_client -connect yourdomain.com:443 again and confirm "Verify return code: 0 (ok)". Alternatively, test with SSL Labs at ssllabs.com/ssltest — a passing grade of A or B confirms the handshake is healthy. Check Nginx/Apache error logs for any residual SSL errors.