1. What HTTPS adds

HTTPS is HTTP carried inside TLS. TLS provides encryption in transit, integrity protection and server authentication when certificate validation succeeds. It does not guarantee that the website itself is trustworthy or that data is safe after it reaches the server.

中文说明:浏览器地址栏出现 HTTPS,只说明连接使用了 TLS;仍需判断域名、证书链、网站身份和应用本身是否可信。

2. Inspect a certificate with OpenSSL

openssl s_client -connect example.com:443 -servername example.com -showcerts

The -servername option sends SNI so a server hosting multiple domains can select the correct certificate. Without it, you may see a default certificate unrelated to the requested hostname.

3. Check certificate dates and names

echo | openssl s_client -connect example.com:443 -servername example.com 2>/dev/null \
 | openssl x509 -noout -subject -issuer -dates -ext subjectAltName

Verify the hostname appears in the Subject Alternative Name extension and the certificate is within its validity period. Also verify the system clock is correct.

4. Test the HTTP layer

curl -Iv https://example.com/
curl --resolve example.com:443:203.0.113.10 -Iv https://example.com/

--resolve directs a specific hostname and port to a chosen IP while preserving the hostname for HTTP Host and TLS SNI. Use it to test a new origin before changing public DNS.

5. Common errors

ErrorLikely causes
Certificate name mismatchWrong certificate selected, missing SAN or wrong hostname.
Expired certificateRenewal failure, wrong clock or stale certificate deployment.
Unknown issuerIncomplete chain or untrusted CA store.
Connection refusedNo listener, wrong IP/port or active reject.
TimeoutRouting, filtering, firewall or upstream availability.

6. Renewal and operations

Use the certificate manager built into your web server or a dedicated ACME client. Monitor expiry, renewal logs and the certificate actually served from the public endpoint. Do not disable certificate verification as a “fix”.

openssl s_client -connect example.com:443 -servername example.com 
Never use curl -k as a permanent solution. It disables certificate verification and hides identity failures.

Verification checklist

  • Correct hostname and SNI.
  • Valid date range and trusted chain.
  • Expected certificate is served by the public endpoint.
  • Application responds after TLS succeeds.
  • Renewal is monitored before expiry.

References & further reading

Commands are examples for a representative Ubuntu/Linux environment. Review paths, versions, access requirements and maintenance impact before applying them to production systems.