The Short Version
On Ubuntu or Debian, with Nginx already serving the site over HTTP:
sudo apt update
sudo apt install certbot python3-certbot-nginx
sudo certbot --nginx -d example.com -d www.example.com --email YOUR_EMAILOn the first run Certbot asks you to accept the Let's Encrypt terms. It then proves to Let's Encrypt that you control the names, adds the certificate to the matching server block, and reloads Nginx.
Before You Start
- DNS points to this server: every name you request needs an A record, and an AAAA record if you use IPv6, that points here. Check with
dig +short example.com Aanddig +short example.com AAAA. Let's Encrypt prefers IPv6 when an AAAA record exists, so an old AAAA record breaks validation even when IPv4 is right. - Port 80 is reachable: the HTTP-01 challenge connects to port 80 from the internet. Keep it open after the switch to HTTPS too, because every renewal uses it again.
- A server block with the names: Certbot finds the block by its
server_line.name - A valid configuration:
sudo nginx -tmust report that the test is successful.
A minimal block in /etc/nginx/sites-available/example.com on Debian and Ubuntu, or /etc/nginx/conf.d/example.com.conf on AlmaLinux and Rocky Linux:
server {
listen 80;
listen [::]:80;
server_name example.com www.example.com;
root /var/www/example.com;
}Open the Firewall
With ufw on Ubuntu and Debian:
sudo ufw allow 80/tcp
sudo ufw allow 443/tcpWith firewalld on AlmaLinux and Rocky Linux:
sudo firewall-cmd --permanent --add-service=http --add-service=https
sudo firewall-cmd --reloadIf your provider's control panel has a firewall in front of the server, open both ports there as well.
Install Certbot on Other Systems
On AlmaLinux and Rocky Linux the packages come from the EPEL repository:
sudo dnf install epel-release
sudo dnf install certbot python3-certbot-nginxThe Certbot project's own instructions install it as a snap on systems that have snapd:
sudo snap install --classic certbot
sudo ln -s /snap/bin/certbot /usr/local/bin/certbotUse one method only. If you move to the snap, remove the distribution package first (sudo apt remove certbot or sudo dnf remove certbot) so two copies do not compete.
Get the Certificate
Name every host the certificate must cover with its own -d. The first name becomes the certificate's name, and the certificate covers only the names you list. A visitor who opens a name that is missing sees a name mismatch, described in NET::ERR_
Current Certbot releases add an HTTP to HTTPS redirect by default and no longer ask about it. Add --no-redirect to leave port 80 serving the site as it is, or --redirect to state the default explicitly.
Certbot adds lines marked # managed by Certbot: a listen 443 ssl line, the paths /etc/letsencrypt/live/example.com/fullchain.pem and privkey.pem, and an include of /etc/letsencrypt/options-ssl-nginx.conf. Never edit or delete the files under /etc/letsencrypt by hand; Certbot manages them.
Check the Result
sudo certbot certificates
curl -I https://example.comThe first command lists each certificate with its names, expiry date, and paths. To see exactly what the server presents, use openssl s_
Make Sure Renewal Works
Let's Encrypt certificates are valid for 90 days today, and Let's Encrypt has announced shorter lifetimes for its default profile: 64 days from 10 February 2027 and 45 days from 16 February 2028. It no longer sends expiry reminder e-mails, so renewal must run by itself. The apt package and the snap install and start a systemd timer. Check that one is listed, and test a renewal:
systemctl list-timers | grep -i certbot
sudo certbot renew --dry-runIf no timer is listed on AlmaLinux or Rocky Linux, switch on the one the EPEL package ships with sudo systemctl enable --now certbot-renew.timer. The dry run uses the Let's Encrypt test system. Timers, hooks, and renewal failures are covered in how to renew Let's Encrypt certificates.
Common Problems
- No matching server block: the
server_line does not contain the name you requested. Fix it, runname sudo nginx -t, reload, and try again. - Timeout or connection refused: port 80 is closed in a firewall, or DNS points somewhere else.
- Unauthorized or 404 on the challenge: another server answered, often through an old AAAA record.
- Too many failed attempts: Let's Encrypt allows five failed validations per name and account each hour. Debug with
--dry-run, which uses the test system, before you try for real.
Details of each run are in /var/log/letsencrypt/letsencrypt.log.
Updated:
Linux VPS with Full Root Access
MUVCloud cloud servers run on KVM with Enterprise NVMe SSD storage and full root access, in Turkey, the Netherlands, and the USA.
More Guides
No Limits on Service or Support
You are not on your own as your projects grow. Our support engineers are ready 24/7, on several channels, whenever you need them.

- 100% customer satisfaction goal
- Our own hardware
- 24/7 ticket and email support
- 4 countries with locations