Install SSL Certificate in Debian
This guide shows you how to install and configure free Let's Encrypt SSL/TLS certificates on Debian 13 (Trixie) and Debian 12 (Bookworm) web servers using Certbot.
Prerequisites
- Apache or Nginx web server installed and serving your site on port 80
- Domain name DNS (
A/AAAArecords) pointing to your server's IP address - Ports 80 and 443 open in your firewall
Step 1: Install Certbot
For Apache:
sudo apt update
sudo apt install -y certbot python3-certbot-apache
For Nginx:
sudo apt update
sudo apt install -y certbot python3-certbot-nginx
Step 2: Obtain SSL Certificate
For Apache
sudo certbot --apache -d yourdomain.com -d www.yourdomain.com
For Nginx
sudo certbot --nginx -d yourdomain.com -d www.yourdomain.com
During setup:
- Terms of Service & Email: Agree to the ACME Terms of Service. Certbot may ask for an optional email address, but note that Let's Encrypt permanently discontinued certificate expiration notification emails on June 4, 2025. Do not rely on reminder emails — rely on Certbot's automatic renewal timer (and external monitoring if needed).
- HTTP to HTTPS Redirect: Modern Certbot versions automatically configure an HTTP-to-HTTPS redirect for Apache and Nginx by default (pass
--no-redirectonly if you want to skip automatic redirection; older Certbot versions prompt interactively).
Step 3: Verify Installation & Test Security
Verify that Certbot issued and tracks your certificate:
sudo certbot certificates
Visit your website with https:// to confirm it loads cleanly, then run post-install checks with:
- CheckTLS.nl — Verify your TLS protocol versions, cipher suites, and certificate chain.
- SecurityHeaders.nl — Inspect your HTTP security headers (such as
Strict-Transport-Security,Content-Security-Policy, and cross-origin isolation) and get stack-specific configuration snippets.
Step 4: Verify Auto-Renewal
Certbot automatically creates a systemd timer (certbot.timer) for renewal. Test the renewal process with a dry run:
sudo certbot renew --dry-run
Check the renewal timer status:
sudo systemctl status certbot.timer
Troubleshooting
Certificate Not Renewing Automatically
Trigger a manual renewal test or check the timer logs:
sudo certbot renew
Check renewal logs:
sudo tail -f /var/log/letsencrypt/letsencrypt.log
Port 80 or 443 Not Accessible
Ensure your UFW firewall allows both HTTP (for ACME HTTP-01 validation) and HTTPS traffic:
sudo ufw allow 80,443/tcp
(Alternatively, you can use UFW application profiles such as sudo ufw allow 'Apache Full' or sudo ufw allow 'Nginx Full' if installed.)
Domain Not Resolving
Verify your DNS records resolve to your server's public IP address:
dig yourdomain.com +short
Additional Resources
- CheckTLS.nl (TLS & Cipher Scanner): https://www.checktls.nl
- SecurityHeaders.nl (HTTP Security Header Scanner): https://www.securityheaders.nl
- Let's Encrypt Documentation: https://letsencrypt.org/docs/