Introduction
Having built secure web applications for fintech companies, I've seen firsthand the critical role that SSL/TLS certificates play in protecting sensitive data. HTTPS is a fundamental requirement for modern web security, user trust, and search engine visibility.
SSL (Secure Sockets Layer) and its successor TLS (Transport Layer Security) are protocols that encrypt data transmitted between a user’s browser and a server. TLS 1.3, published in 2018, simplifies the handshake and improves both security and performance. This tutorial explains how to obtain and install SSL/TLS certificates, configure servers for secure TLS, and troubleshoot common problems so you can meet security standards and reduce operational risk.
We focus on practical, reproducible steps using widely used tools (OpenSSL, Certbot, Nginx, Apache) and include configuration snippets, security recommendations (HSTS, OCSP stapling, DNS CAA), and troubleshooting commands you can run immediately. Recommended minimums: OpenSSL 1.1.1+ for TLS 1.3 support and an ACME client such as Certbot (ACME v2-aware).Â
How SSL/TLS Certificates Work: The Encryption Process
The Role of Encryption in SSL/TLS
Encryption is foundational to SSL/TLS, ensuring secure data transmission. When you connect to a website using HTTPS, the browser and server perform a handshake to negotiate protocols, authenticate the server, and establish symmetric session keys for efficient encryption of application data.
During the handshake the server provides its certificate (containing the public key and identity information). The client verifies the certificate against trusted Certificate Authorities (CAs) and validated chains. Once verified, the client and server complete key exchange (often using ephemeral keys such as ECDHE) so a single session key encrypts traffic for that connection, ensuring forward secrecy when configured properly.
- Encryption protects sensitive information in transit
- Handshakes negotiate protocol versions and ciphers
- Certificates establish server identity via CA trust chains
- Ephemeral key exchange provides forward secrecy
Quick inspection: use OpenSSL to view a server certificate and handshake details:
openssl s_client -connect example.com:443 -servername example.com
This prints the server certificate chain, negotiated cipher, and protocol. Replace example.com with your domain and include -showcerts to show all chain certificates.
| Step | Description | Purpose |
|---|---|---|
| Handshake | Client and server negotiate version, ciphers, and exchange certificates | Establish secure parameters and authenticate peer |
| Key exchange | Use ECDHE or RSA to agree on a session key | Encrypt data transmission with forward secrecy |
| Verification | Client validates server certificate chain against CAs | Confirm server identity and prevent impersonation |
Types of SSL/TLS Certificates: Which One is Right for You?
Understanding Different SSL/TLS Certificates
Certificates differ by validation level and coverage:
- Domain Validated (DV) — validates domain control only. Fast issuance; suitable for blogs and basic sites.
- Organization Validated (OV) — verifies the organization in addition to domain ownership. Good for business sites wanting moderate assurance.
- Extended Validation (EV) — more extensive vetting and higher visual trust indicators in some clients. Appropriate for high-risk transaction sites.
- Wildcard — covers a base domain and all first-level subdomains (e.g., *.example.com).
For most modern sites, a DV certificate from an automated CA is sufficient for encryption. For regulatory or extra trust requirements, consider OV or EV from commercial CAs.
Automated tooling such as Certbot (ACME v2-capable) and the Let's Encrypt CA make DV issuance and renewal straightforward. Certbot integrates with Nginx and Apache plugins to automate validation and renewal.
The Importance of HTTPS: Why Every Site Needs It
The Role of HTTPS in Security
Implementing HTTPS is essential for protecting data-in-transit and reducing the attack surface for interception and tampering. HTTPS also enables modern browser features (secure cookies, Service Worker scope) and is expected by users and platforms.
In practice, switching to HTTPS reduces certain classes of automated attacks and improves user trust. It also enables additional protections like HSTS and OCSP stapling, which harden the connection against downgrade and spoofing attacks.
- Encrypts data during transmission
- Enables secure browser features and policies
- Improves operational security posture
- Supports privacy and compliance requirements
Obtaining and Installing SSL/TLS Certificates: A Step-by-Step Guide
Overview
The examples below use Certbot for automation and include both Nginx and Apache workflows. Replace example.com with your domain and run commands with appropriate privileges (sudo where applicable). This guide assumes OpenSSL 1.1.1+ (TLS 1.3 support) and a modern ACME-capable Certbot client.
A. Using Certbot with Nginx (recommended for many Linux hosts)
- Install Certbot and the Nginx plugin. See Certbot for platform-specific instructions.
- Obtain a certificate using the Nginx plugin (automates verification and config):
sudo certbot --nginx -d example.com -d www.example.comThis will request a certificate and update your Nginx configuration automatically where possible.
- If you prefer manual Nginx configuration, use the standalone or webroot method and then configure Nginx to use the certificate paths from Let's Encrypt:
# Obtain cert (webroot example)
sudo certbot certonly --webroot -w /var/www/html -d example.com -d www.example.com
# Certificate files will be in /etc/letsencrypt/live/example.com/
# Example Nginx server block snippet:
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;
# Only enable modern protocols
ssl_protocols TLSv1.2 TLSv1.3;
ssl_prefer_server_ciphers on;
ssl_ciphers "ECDHE-ECDSA-AES256-GCM-SHA384:ECDHE-RSA-AES256-GCM-SHA384:..."; # Review ciphers with Mozilla SSL Configuration Generator: https://mozilla.org
# OCSP stapling
ssl_stapling on;
ssl_stapling_verify on;
# Use reliable DNS resolvers for OCSP checks. Consider local or trusted resolvers for performance/security (e.g., 127.0.0.53, 1.1.1.1, 8.8.8.8)
resolver 1.1.1.1 8.8.8.8 127.0.0.53 valid=300s;
resolver_timeout 5s;
# HSTS (enable after verifying HTTPS works)
add_header Strict-Transport-Security "max-age=63072000; includeSubDomains; preload" always;
root /var/www/html;
}
# Redirect HTTP to HTTPS
server {
listen 80;
server_name example.com www.example.com;
return 301 https://$host$request_uri;
}
Operational note: Regularly review and update the ssl_ciphers list using a trusted configuration source such as the Mozilla SSL Configuration Generator. Cipher recommendations change over time — keep OpenSSL updated (OpenSSL 1.1.1 or later) and re-evaluate ciphers quarterly or after major library updates.
- Test the Nginx configuration and reload:
sudo nginx -t
sudo systemctl reload nginx
- Verify certificate details and handshake:
openssl s_client -connect example.com:443 -servername example.com -showcerts # For TLS 1.3-specific check: openssl s_client -connect example.com:443 -servername example.com -tls1_3 - Automate renewal (Certbot installs a cron/systemd timer). You can test renewal with:
sudo certbot renew --dry-run
B. Using Certbot with Apache
- Install Certbot and the Apache plugin for your distribution.
- Request and install automatically:
sudo certbot --apache -d example.com -d www.example.comThe Apache plugin updates virtual hosts to use the new certificates.
- Verify Apache config and restart:
sudo apachectl configtest sudo systemctl reload apache2 - Test renewal as above with
sudo certbot renew --dry-run.
C. Manual CSR and Commercial CAs
- Generate a private key and CSR on your server (example using OpenSSL):
openssl genrsa -out example.com.key 2048 openssl req -new -key example.com.key -out example.com.csr -subj "/CN=example.com/O=Your Company/C=US" - Submit the CSR to your chosen CA (DigiCert, Sectigo, GlobalSign, etc.). The CA will provide certificates and intermediate chain files.
- Install the provided certificate and intermediate chain into your server config (paths vary by server). Ensure the certificate chain is complete (server cert + intermediates).
Security checklist after installation
- Enforce TLS 1.2 and TLS 1.3 only (disable SSL 3.0, TLS 1.0, TLS 1.1)
- Enable HSTS after thorough testing (confirm subdomains and services)
- Enable OCSP stapling to improve revocation checks
- Use DNS CAA records to restrict which CAs can issue certs for your domain (example below)
- Monitor certificates and automate renewal to avoid expiry
Advanced Troubleshooting and Common Issues
Below are common failures and the commands/configs to investigate and resolve them.
Certificate expired or near-expiry
Symptoms: browser warnings, failed connections. Inspect certificate:
openssl s_client -connect example.com:443 -servername example.com 2>/dev/null | openssl x509 -noout -dates
Fix: renew with your CA or Certbot; verify automated renewal is enabled. Test with certbot renew --dry-run. Add monitoring/alerts (email, PagerDuty, Prometheus alert) to catch expiry before user impact.
Incomplete chain / missing intermediate CA
Symptoms: some clients (mobile, older OS) reject the cert. Check chain:
openssl s_client -connect example.com:443 -servername example.com -showcerts
Fix: concatenate server certificate and intermediate(s) into the configured fullchain.pem or follow CA-provided installation instructions. Verify with SSL/TLS analyzers and test on mobile clients.
Name mismatch (certificate common name / SANs)
Symptoms: "NET::ERR_CERT_COMMON_NAME_INVALID" or similar. Check the certificate subject and SANs:
openssl s_client -connect example.com:443 -servername example.com 2>/dev/null | openssl x509 -noout -text | grep -A2 "Subject:"
Fix: reissue certificate including the correct domain names or add appropriate SANs. For multi-service deployments prefer multi-domain (SAN) certs or short-lived certs per service with automation.
OCSP / stapling issues
Symptoms: slow TLS handshakes or stapling errors. Check server logs and enable stapling verification. In Nginx, ensure resolver points to reliable DNS and that the server can reach the CA's OCSP responder. If stapling is unreliable, diagnose reachability to the CA and reload stapling cache frequently.
TLS handshake failures (protocol or cipher incompatibilities)
Commands to inspect negotiation:
openssl s_client -connect example.com:443 -servername example.com -cipher 'ECDHE' -tls1_2
curl -vI https://example.com/
# Check TLS 1.3 negotiation explicitly:
openssl s_client -connect example.com:443 -servername example.com -tls1_3
Fix: adjust ssl_protocols and ssl_ciphers to support modern secure ciphers while disabling weak ones. Test with modern clients and browser SSL/TLS analyzers. Keep OpenSSL and server packages patched.
Firewall / port blocking
Ensure ports 80 and 443 are open for inbound connections (HTTP validation uses port 80 for many ACME flows). Verify with:
sudo ss -ltnp | grep -E ':80|:443'
# or
sudo ufw status
Rate limits and CA errors
If you hit issuance rate limits with Let's Encrypt, back off and consolidate requests (use wildcard certificates or multi-domain certs) and check the ACME client logs for exact error messages. For large fleets, consider a managed PKI or internal issuing CA with short-lived certs and an automated rotation process.
Troubleshooting approach
- Reproduce the failure locally and capture TLS handshake with OpenSSL.
- Check server logs (Nginx/Apache error logs) for stack traces or CA validation errors.
- Verify DNS (A/AAAA records), firewall rules, and that the public IP maps to your certificate domain.
- Test certificate chain and renewal with Certbot dry-run.
Future of SSL/TLS: Trends and Best Practices for Security
Emerging trends
Key movements in the TLS ecosystem include wider deployment of Certificate Transparency logs for monitoring certificate issuance and broader adoption of TLS 1.3 for its security and performance benefits. Automated certificate management and robust observability (monitoring certificate expiry and chain health) are increasingly standard in production environments.
Another important trend is HTTP/3 (QUIC). HTTP/3 relies on TLS 1.3 for its cryptographic handshake, so enabling and correctly configuring TLS 1.3 is a prerequisite for adopting HTTP/3. When planning HTTP/3, verify your server and CDN support it (server builds and library stacks must include QUIC/HTTP/3 support).
Best Practices for Ongoing Management
- Automate renewals and have alerting on failures — Certbot and other ACME clients support hooks and timers to integrate with your deployment pipeline.
- Disable legacy protocols (SSL 2/3, TLS 1.0/1.1) and weak ciphers; prefer ephemeral key exchanges (ECDHE) and TLS 1.3 where possible.
- Use HSTS cautiously: enable after confirming all subdomains are covered to avoid locking out users during misconfiguration.
- Publish DNS CAA records to limit which CAs can issue certificates for your domain and monitor Certificate Transparency logs for unexpected issuance.
- Regularly audit TLS configurations with tools and internal tests; treat certificate management as part of your infrastructure reliability engineering.
Key Takeaways
- SSL/TLS certificates encrypt data between clients and servers; prefer TLS 1.3 (and TLS 1.2 where needed) for modern deployments.
- Let's Encrypt + Certbot provide automated, low-cost issuance for most sites; ensure automated renewal to avoid expiry outages.
- HSTS, OCSP stapling, DNS CAA records, and correct chain installation improve security and client behavior—apply them after testing.
- Proactive monitoring and clear troubleshooting steps reduce downtime and mitigate common certificate-related failures.
Frequently Asked Questions
- How do I choose between different SSL certificate providers?
- Choose based on your trust needs and operational model. For basic encryption, automated DV certificates (Let's Encrypt) work well. For additional organizational assurance or regulatory requirements, use OV/EV from commercial CAs with support and warranty options.
- What happens if my SSL certificate expires?
- An expired certificate causes browsers to show warnings and can break integrations. Automate renewal (Certbot/systemd timers or managed CA services) and set alerts ahead of expiry.
- Is it necessary to use HSTS with SSL/TLS?
- HSTS strengthens HTTPS enforcement but must be enabled carefully. Deploy HSTS only after you confirm that HTTPS is reliably served on all relevant hostnames and subdomains to avoid locking users out.
Conclusion
Understanding and correctly implementing SSL/TLS certificates is central to protecting data in transit. Practical, repeatable processes—automated issuance and renewal, modern TLS configuration, and monitoring—significantly reduce risk and operational overhead. Use the commands and configuration examples above as a basis for deployment, and adapt them to your environment and compliance needs.
For further reading and authoritative resources, consult the CA and tooling home pages: Let's Encrypt, Certbot, and general security guidance at OWASP.
