The Complete HTTPS Certificate Guide: From TLS Handshake to Automated Renewal

The three things HTTPS protects

TLS does three jobs at the transport layer, and skipping any one means it is not "configured":

Property Mechanism What it stops
Confidentiality Symmetric keys negotiated during the handshake Eavesdropping on the wire, packet capture on public Wi-Fi
Integrity AEAD authentication tags over every segment A middlebox altering responses, injecting ads or scripts
Identity A certificate binding the domain to a public key, backed by a CA Phishing sites impersonating you, fake servers after DNS hijacking

Three boundaries matter: HTTPS does not protect the server itself (XSS and SQL injection still apply), does not make content trustworthy (a phishing site can buy a DV certificate too), and does not replace application-level authentication. It only guarantees that you reached this domain and that nothing was altered in transit.

Browsers send https:// to port 443 and http:// to port 80 by default; see the port reference for the common assignments.

The TLS 1.3 handshake: where the saved round trip comes from

Client                                      Server
  │  ClientHello (supported suites + key share)   │
  ├──────────────────────────────────────────────▶│
  │                                               │
  │  ServerHello + Certificate + Finished         │
  │◀──────────────────────────────────────────────┤
  │  Finished                                     │
  ├──────────────────────────────────────────────▶│
  │              Application Data                 │

TLS 1.2 needs two round trips: the first negotiates algorithms and delivers the certificate, the second exchanges key material and completes validation. TLS 1.3 puts the key share into the first ClientHello, so the server derives the shared secret in its reply and sends the certificate together with Finished. That saved round trip is a visible first-paint improvement on high-latency links.

Three changes come with it:

  • Only ephemeral key exchange (ECDHE) remains, making forward secrecy the default: leaking the long-term private key still cannot decrypt past traffic.
  • RSA key exchange, compression, and renegotiation are gone, shrinking the attack surface.
  • The certificate still travels in the clear (it is public information); confidentiality comes from the negotiated session key, not from "encrypting the certificate".

The chain: why desktops work and phones fail

Root CA (preinstalled in the OS / browser trust store)
   └── Intermediate CA (the server should send it alongside the leaf)
          └── Leaf certificate (your domain)

Browsers walk upward from the leaf until they reach a root in their own trust store. Three common breaks:

  1. The server sends only the leaf, no intermediate. Desktop browsers may fetch it automatically through AIA (Authority Information Access); phones and command-line clients will not, so only mobile fails.
  2. The intermediate expired or the root is too old. Older Android devices lack newer roots that desktops already carry.
  3. The certificate lacks the requested name. Validation uses SAN (Subject Alternative Name), not CN; www and the apex are two different names.

The fix is uniform: point Nginx's ssl_certificate at fullchain.pem (leaf plus intermediate), never cert.pem. First, see what the server actually sends:

openssl s_client -connect example.com:443 -servername example.com -showcerts </dev/null

At least two certificates should appear. A single one means the chain is incomplete.

Certificate types: validation level and coverage

Validation level

Type What the CA verifies Issuance speed Browser treatment Use for
DV (Domain Validated) Domain control only Automated, minutes Standard lock icon Almost every site, API, internal service
OV (Organization Validated) Also verifies the organization exists Manual, days Standard lock icon Corporate sites that must display a legal entity
EV (Extended Validation) Strictest offline checks Manual, days No longer distinguished in modern browsers Finance, heavy compliance

Conclusion: DV is enough. Encryption strength has nothing to do with certificate class — DV and EV run the same TLS. Browsers removed the company-name display that EV once bought, so the extra money buys neither ranking nor trust.

Coverage

Type Covers Does not cover
Single domain example.com www.example.com (unless added as a SAN)
Wildcard *.example.com a.example.com, b.example.com The apex example.com, or a.b.example.com
Multi-domain (SAN) Every name listed in the certificate Any name not listed

Wildcards match one level only and exclude the apex. The classic failure is buying *.example.com and then finding https://example.com broken — add the apex to the SAN.

Where to get one, and how ACME validates

Path Cost Renewal management Fits
Commercial CA Paid Manual or API OV/EV, invoices, SLAs
Free CA (ACME) Free Must be automated Personal sites, tool sites, internal services
Self-signed Free Manual Local development and intranet tests, never public sites

ACME offers three validation methods; picking the wrong one blocks issuance:

  • HTTP-01: the CA fetches http://your-domain/.well-known/acme-challenge/<token>. Port 80 must be publicly reachable, no login redirects, no CDN serving a stale cached response. Wildcards are not supported.
  • DNS-01: add a TXT record. Supports wildcards and works when port 80 is blocked, the site sits behind a CDN, or issuance must happen offline; the cost is DNS API access.
  • TLS-ALPN-01: answer on port 443 with a special ALPN protocol, for environments that cannot open 80 but can open 443.

RSA or ECDSA

Dimension RSA ECDSA
Typical key size 2048 / 4096 bits P-256
Handshake cost Higher Clearly lower
Certificate size Larger Smaller
Compatibility Very broad, including old devices A few legacy systems do not support it
Security level 2048-bit roughly matches P-256 Shorter keys at comparable strength

Default to ECDSA P-256 for faster handshakes and smaller certificates; when serving old Android or embedded clients, deploy an RSA certificate alongside it as a fallback.

# Private key and CSR (ECDSA)
openssl ecparam -name prime256v1 -genkey -noout -out private.pem
openssl req -new -key private.pem -out request.csr

# RSA for comparison
openssl genrsa -out private.pem 2048

You can also generate a comparison keypair with the RSA key generator. A certificate fingerprint is a hash, so verify it with the hash tool; algorithm details are in the hash algorithm reference.

Nginx deployment and three traps

server {
    listen 80;
    server_name example.com www.example.com;
    return 301 https://$host$request_uri;
}

server {
    listen 443 ssl http2;
    server_name example.com www.example.com;

    ssl_certificate     /etc/letsencrypt/live/example.com/fullchain.pem;
    ssl_certificate_key /etc/letsencrypt/live/example.com/privkey.pem;

    ssl_protocols TLSv1.2 TLSv1.3;
    ssl_prefer_server_ciphers off;

    add_header Strict-Transport-Security "max-age=31536000; includeSubDomains" always;

    location / {
        proxy_pass http://backend;
        proxy_set_header X-Forwarded-Proto $scheme;
    }
}

Trap 1: pointing ssl_certificate at cert.pem. Use fullchain.pem; otherwise the intermediate is missing and desktops may work while phones fail.

Trap 2: renewing without reloading. Nginx reads certificates into memory at startup, so a replaced file keeps serving the old certificate until reloaded; configure the ACME client's deploy hook to run nginx -s reload.

Trap 3: HSTS is hard to undo. includeSubDomains locks every subdomain into HTTPS, and any subdomain without a certificate becomes unreachable. Validate on a test domain first, raise max-age gradually, and add includeSubDomains only once the whole site is HTTPS. Header semantics are in the HTTP headers cheat sheet; more directives are in the Nginx configuration reference.

If a redirect loop appears behind a reverse proxy, the backend usually sees only HTTP and 301s back to HTTPS; forward the real scheme with X-Forwarded-Proto.

Troubleshooting table

Browser error Real cause Fix
CERT_DATE_INVALID Certificate expired, or the client clock is wrong Renew and reload; check the device time
CERT_COMMON_NAME_INVALID The SAN lacks the requested name Reissue with www / apex included
CERT_AUTHORITY_INVALID Self-signed, or an incomplete chain Use a CA certificate publicly; ship fullchain.pem
Only phones fail Missing intermediate, or an old trust store Send the full chain; use a compatible root if needed
Mixed content blocked Hard-coded http:// resources in the page Use relative URLs or full HTTPS, plus CSP
Too many redirects The proxy layer misreads the scheme Pass X-Forwarded-Proto, break the loop

Automated renewal and monitoring

  • Renewal: schedule the ACME client, rehearse with --dry-run first, then wire a deploy hook that reloads Nginx.
  • Verification: after renewal, rerun s_client to confirm both the chain and the names.
  • Monitoring: an independent probe checks expiry daily and alerts a month ahead; never rely on the "renewal succeeded" log, because a written file that was never reloaded is a common failure.
# Check expiry
echo | openssl s_client -connect example.com:443 -servername example.com 2>/dev/null \
  | openssl x509 -noout -dates -subject -issuer

Reproducible results

# 1. See the chain the server actually sends (expect two or more certificates)
openssl s_client -connect example.com:443 -servername example.com -showcerts </dev/null

# 2. See which names the leaf covers and when it expires
echo | openssl s_client -connect example.com:443 -servername example.com 2>/dev/null \
  | openssl x509 -noout -ext subjectAltName -dates

# 3. Compute the SHA-256 fingerprint and compare it with the CA dashboard
echo | openssl s_client -connect example.com:443 -servername example.com 2>/dev/null \
  | openssl x509 -noout -fingerprint -sha256

Step 1 showing one certificate means the chain is incomplete; step 2 missing the current name means a name mismatch; step 3 mismatching means you received a certificate other than the one you issued.

Frequently Asked Questions

Is there any difference in encryption strength between free and paid certificates?

No. Both use identical algorithms and key lengths, the browser padlock looks the same, and an observer cannot tell from the traffic whether your certificate was free or paid. The real differences are: validation level (free CAs usually offer only DV; OV/EV are paid), validity period (free certificates are typically 90 days, paid ones can run a year), warranty coverage, and availability of wildcard or IP certificates. For the vast majority of sites, a free DV certificate provides all the encryption strength you need.

The browser says the certificate is untrusted, but it has not expired. What is the most likely cause?

The most common cause is an incomplete certificate chain: the server sends only the leaf certificate and omits the intermediate CA certificate. Browsers ship root certificates locally and cannot derive a missing intermediate out of thin air, so they report the chain as untrusted. The fix is to deploy the intermediate and leaf certificates concatenated into one file (the fullchain). Beware that this failure is deceptive: many desktop browsers will fetch the missing intermediate via the AIA extension or a cache and display the site fine, while mobile browsers, curl, and API clients fail outright — so never validate with a browser alone.

Should I choose an RSA or an ECDSA certificate?

Prefer ECDSA (P-256) unless you have a concrete legacy-compatibility burden. P-256 delivers security roughly equivalent to RSA 3072 with a far shorter key, a faster handshake, and lower CPU and bandwidth cost — a clear win for mobile clients and high-traffic sites. The tradeoff is that very old clients (pre-Android 4.x, Windows XP, some Java 6/7 runtimes) lack ECDSA support. The safe approach is dual certificates: configure ECDSA and RSA side by side so modern clients negotiate ECDSA and legacy clients fall back to RSA automatically. Nginx 1.11+ supports this natively.

How often should certificates be renewed? Is a 90-day lifetime too short?

Ninety days is the direction the industry is moving, not a flaw — the CA/Browser Forum has already voted to phase the maximum lifetime down to 47 days. Short lifetimes limit the exposure window after a private-key leak and force automation. The right response is not to buy a longer certificate but to automate renewal completely: use an ACME client (certbot or acme.sh) driven by a systemd timer or cron that checks daily and renews 30 days before expiry, then reloads the service. Add expiry monitoring that alerts below 21 days remaining and humans never have to think about it again.

← Back to Blog