Install SSL Certificate in Debian 12, 11 and 10

This guide shows you how to install and configure Let's Encrypt SSL certificates on your Debian web server using Certbot.

Prerequisites

Step 1: Install Certbot

Debian 12 or 11

sudo apt update
sudo apt install python3-certbot-apache

For Nginx instead of Apache

sudo apt install python3-certbot-nginx

Debian 10

sudo apt update
sudo apt install certbot python3-certbot-apache

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

Follow the interactive prompts:

Step 3: Verify Installation

Test your SSL certificate:

sudo certbot certificates

Visit your website with https:// to confirm it's working.

Step 4: Configure Auto-Renewal

Certbot automatically sets up renewal. Test the renewal process:

sudo certbot renew --dry-run

Check the renewal timer status:

sudo systemctl status certbot.timer

Troubleshooting

Certificate Not Renewing Automatically

Manual renewal:

sudo certbot renew

Check renewal logs:

sudo tail -f /var/log/letsencrypt/letsencrypt.log

Port 80 Not Accessible

Ensure your firewall allows HTTP and HTTPS:

sudo ufw allow 'Apache Full'

Or for Nginx:

sudo ufw allow 'Nginx Full'

Domain Not Resolving

Verify DNS settings:

dig yourdomain.com +short

Additional Resources

User