Let's Encrypt — Useful Commands & Troubleshooting
Quick-access Let's Encrypt and Certbot commands for issuing, renewing, verifying SSL/TLS certificates, plus common troubleshooting steps.
🔐 Certificate command cli
Let’s Encrypt — Useful Commands & Troubleshooting#
A compact toolbox of common Certbot commands, copy-ready snippets, and real-world fixes engineers frequently use while working with Let’s Encrypt.
This is not a step-by-step guide — just the things you actually search for in production.
🔧 Install Certbot#
Ubuntu / Debian#
sudo apt update
sudo apt install certbot python3-certbot-nginxbashRHEL / CentOS#
sudo dnf install certbot python3-certbot-nginxbash🔒 Issue New Certificates#
Issue certificate (NGINX)#
sudo certbot --nginx -d example.com -d www.example.combashIssue certificate (Apache)#
sudo certbot --apache -d example.combashStandalone mode (when no web server is running)#
sudo certbot certonly --standalone -d example.combashDNS Challenge (e.g., Cloudflare)#
Useful for wildcard certificates.
sudo certbot certonly \
--dns-cloudflare \
--dns-cloudflare-credentials ~/.secrets/cloudflare.ini \
-d example.com -d '*.example.com'bash♻️ Renewal Commands#
Test renewal#
sudo certbot renew --dry-runbashForce renewal#
sudo certbot renew --force-renewalbashCheck auto-renew timer (systemd)#
systemctl list-timers | grep certbotbash📂 Certificate File Locations#
/etc/letsencrypt/live/<domain>/fullchain.pem
/etc/letsencrypt/live/<domain>/privkey.pem
/etc/letsencrypt/live/<domain>/chain.pemplaintext🧪 Verification Commands#
Check certificate expiry#
sudo openssl x509 -in /etc/letsencrypt/live/example.com/cert.pem -noout -enddatebashView certificate details#
sudo openssl x509 -in fullchain.pem -noout -textbashTest HTTPS endpoint#
curl -I https://example.combash🐞 Common Errors & Fixes#
❗ Port 80 Already in Use#
Problem binding to port 80.plaintextFind process:
sudo lsof -i :80bashStop conflicting service:
sudo systemctl stop <service>bashAlternatively use DNS challenge:
sudo certbot certonly --dns-cloudflare ...bash❗ NGINX Plugin Not Found#
The nginx plugin is not installed.plaintextInstall plugin:
sudo apt install python3-certbot-nginxbash❗ Cloudflare SSL Errors (525 / handshake failed)#
Fix checklist:
- Set Cloudflare SSL mode → Full, not “Full (Strict)”
- Disable “Always Use HTTPS” temporarily
- Ensure server certificate is valid
❗ Auto-Renew Not Executing#
Check logs:
sudo cat /var/log/letsencrypt/letsencrypt.logbashRun manually:
sudo certbot renew --dry-runbash❗ Wildcard certificate not issued#
Wildcard certificates require DNS-01 challenge — HTTP-01 cannot issue them.
🧰 Utility Commands#
List installed certificates#
sudo certbot certificatesbashDelete a certificate#
sudo certbot delete --cert-name example.combashReload web server after renewal#
NGINX:
sudo systemctl reload nginxbashApache:
sudo systemctl reload apache2bash📝 Tip#
If you’re using Load Balancers, Proxies, or Cloudflare in front of your server, always ensure that:
- Port 80 is reachable for HTTP-01 challenges
- DNS records propagate before re-issuing
- Certificates are reloaded after renewal
Published: 12/8/2025
Back to DevTools