# How to set up Let's Encrypt on a VPS?

> How to set up Let's Encrypt on a VPS with certbot in 6 steps: DNS, port 80 open, certbot --nginx, a renewal dry run and the files in /etc/letsencrypt.

- URL: https://ironkvm.com/guides/how-to-set-up-lets-encrypt-on-a-vps/
- Last updated: 2026-11-16
- Publisher: IronKVM (https://ironkvm.com)

Free HTTPS certificates from Let’s Encrypt, issued and renewed by certbot, following the instructions of the EFF.

**Quick answer — How to set up Let's Encrypt on a VPS?**

To set up Let's Encrypt on a VPS, point the domain to the server, open port 80 and 443, install certbot, run sudo certbot --nginx and test renewal with certbot renew --dry-run. On an **IronKVM** VPS with nginx it takes 6 steps; certificates land in /etc/letsencrypt/live and renew on their own.

**In brief**

- The EFF installs certbot with snap: `snap install --classic certbot`.
- `certbot --nginx` gets the certificate and edits the nginx config for HTTPS.
- The HTTP-01 check uses port 80, so the firewall must allow it.
- Renewal runs from a systemd timer or a cron job; test it with a dry run.
- `certbot certificates` lists each certificate, its domains and its expiry date.

## Which certbot method should you use?

*certbot methods for a VPS and when each fits, from the certbot user guide and EFF instructions*

| Method | Command | When it fits |
| --- | --- | --- |
| nginx plugin | certbot --nginx | nginx serves the site; certbot edits the config |
| Webroot | certbot certonly --webroot -w /var/www/example.org -d example.org | You want to edit the config yourself |
| Standalone | certbot certonly --standalone -d example.org | No web server yet; port 80 must be free |
| Several names | -d example.org -d www.example.org | One certificate for each listed name |

## What are the steps to set up Let's Encrypt on a VPS?

1. **Point DNS to the VPS** — The A and AAAA records of every name on the certificate must resolve to the server.
2. **Serve the site on port 80** — nginx needs a server block whose server_name lists the same names.
3. **Open the firewall** — Allow 80/tcp and 443/tcp. The HTTP-01 check reaches the server on port 80.
4. **Install certbot** — Install snapd, then certbot with snap install --classic certbot, and link it into /usr/local/bin.
5. **Get the certificate** — Run sudo certbot --nginx, pick the names and give an email for expiry notices if you want one.
6. **Test the renewal** — Run sudo certbot renew --dry-run and check the timer with systemctl list-timers.

*Install certbot and get a certificate (EFF snap method)*

```bash
sudo apt install snapd
sudo snap install --classic certbot
sudo ln -s /snap/bin/certbot /usr/local/bin/certbot
sudo ufw allow 80/tcp && sudo ufw allow 443/tcp
sudo certbot --nginx -d example.org -d www.example.org
sudo certbot renew --dry-run
sudo certbot certificates
```

## What does certbot --nginx change?

**It adds the certificate paths and a listen 443 ssl block to the matching server block, and can redirect HTTP to HTTPS.** The EFF instructions say the command gets a certificate and has certbot edit the nginx configuration to serve it.

The files stay under /etc/letsencrypt/live/example.org. The certbot user guide recommends pointing the server config at those paths rather than copying the files, so renewals apply without changes. Run `sudo nginx -t` after any manual edit. The [website hosting guide](https://ironkvm.com/guides/how-to-host-a-website-on-an-offshore-vps/ "How to host a website on an offshore VPS?") shows the server block certbot starts from.

## Why does the Let's Encrypt check fail on a VPS?

**Usually because DNS does not point to the VPS yet, or port 80 is closed.** The HTTP-01 challenge fetches a file from each name over port 80. If the A record still points to the old host, the check reaches the wrong server.

Check the record with `dig +short example.org`. Check the firewall with `ufw status`; the [UFW guide](https://ironkvm.com/guides/how-to-set-up-a-firewall-with-ufw/ "How to set up a firewall with UFW?") opens both ports. When you migrate a site, issue the certificate after the DNS switch, as [how to move a website to an offshore VPS](https://ironkvm.com/guides/how-to-move-a-website-to-an-offshore-vps/ "How to move a website to an offshore VPS?") explains.

## Which VPS is best for HTTPS sites in 2026?

**Any plan: TLS costs little CPU, so size the server for the site, not the certificate.** A static site runs on Billet; [WordPress](https://ironkvm.com/guides/how-to-install-wordpress-on-a-vps/ "How to install WordPress on a VPS?") is happier on Ingot. Anvil, with 6 vCPU, 16 GB RAM, 240 GB NVMe, 12 TB traffic, holds many sites for $15.00 a month on 12 months.

According to IronKVM's survey of 16 November 2026, plans comparable to Anvil cost a median of $77.50 a month across 12 hosts. Each VPS has one IPv4 address and an IPv6 /64, enough for any number of HTTPS sites behind nginx.

## Let's Encrypt on a VPS: questions

### Is Let's Encrypt free?

Yes. Let’s Encrypt issues certificates at no charge, and certbot is free software published by the EFF.

### How do I renew a Let's Encrypt certificate?

Renewal is automatic through a systemd timer or cron job. Test it any time with certbot renew --dry-run.

### Can one certificate cover www and the bare domain?

Yes. Pass both with -d example.org -d www.example.org.

### Do I need port 80 open after the certificate is issued?

Yes for HTTP-01 renewals, which check over port 80 each time.

### Does IronKVM install certificates for me?

No. The VPS is yours to run; certbot does the work in one command.

**Verdict**

- **DNS first, port 80 open, then certbot --nginx**: HTTPS is set up and renews on its own.
- **On IronKVM**, any plan serves HTTPS sites; size the plan for the site itself.

## Sources

1. [Certbot instructions: nginx on Linux (snap)](https://certbot.eff.org/instructions?ws=nginx&os=snap) — Electronic Frontier Foundation (read 2026-11-16)
2. [Certbot user guide](https://eff-certbot.readthedocs.io/en/stable/using.html) — Electronic Frontier Foundation (read 2026-11-16)
3. [Firewalls](https://ubuntu.com/server/docs/how-to/security/firewalls/) — Canonical (read 2026-11-16)
4. [IronKVM offshore VPS survey (CSV)](https://ironkvm.com/data/ironkvm-offshore-vps-survey-2026-11-16.csv) — IronKVM (read 2026-11-16)

**Host HTTPS sites on your own VPS** Anvil, 6 vCPU, 16 GB RAM, 240 GB NVMe, 12 TB traffic, $15.00 a month on 12 months. [Order Anvil](https://ironkvm.com/app/checkout/?plan=anvil&term=12m&from=guide-lets-encrypt&lang=en) · [Compare the plans](https://ironkvm.com/pricing/ "IronKVM prices 2026: how much does an offshore KVM VPS cost?")

---

IronKVM: IronKVM is an offshore KVM VPS provider with servers in the Netherlands, Romania and Moldova that takes no action on DMCA takedown notices, for content that is legal in the server's country. It is paid in crypto with no ID upload and run by DomaineGoat LLC, a company registered in Panama. On the 12-month term each plan costs at least 25% less than a named comparable plan read on 16 November 2026.
