Skip to main content
⚡ OpenDevDocs
Deployment
devopsdeploymentGuideBeginner

Configuring Free SSL/TLS with Let's Encrypt & Certbot

Complete guide to obtaining, installing, and auto-renewing free SSL/TLS certificates for Nginx and Apache using Certbot and Let's Encrypt.

Verified: 2026-09-30
Tested on:certbot 2.11.x, ubuntu 24.04
Platforms:
linux
#ssl#https#certbot#letsencrypt#nginx#security

Let's Encrypt provides free, automated 90-day X.509 certificates. Certbot is the official Electronic Frontier Foundation (EFF) client that handles domain challenge verification, certificate installation, and automated renewals.


Prerequisites

  1. An Ubuntu/Debian Linux VPS with public IPv4.
  2. A registered domain name with an A record pointing to the VPS IP address.
  3. Ports 80 and 443 open in your firewall (sudo ufw allow 'Nginx Full').

Step-by-Step Installation

```bash
sudo certbot --nginx -d example.com -d www.example.com
```

Follow the interactive prompts:
- Enter your emergency contact email address.
- Agree to the Terms of Service.
- Choose whether to automatically redirect HTTP traffic to HTTPS (Select **Yes / Redirect**).
Test the renewal workflow with a dry run:
```bash
sudo certbot renew --dry-run
```

Useful Certbot Commands

# List all installed certificates and expiration dates
sudo certbot certificates

# Force immediate renewal
sudo certbot renew --force-renewal

# Revoke a compromised certificate
sudo certbot revoke --cert-path /etc/letsencrypt/live/example.com/cert.pem

On this page