Skip to content
VDS · Websites and web servers

Free Let's Encrypt certificate

How to issue and automatically renew an HTTPS certificate on a VPS with certbot, including the case when port 80 is already in use.

Updated August 23, 2026

You need a certificate so the browser doesn't show “Not secure” and forms and payments work at all. Let's Encrypt issues one for free for 90 days with automatic renewal.

Preparation

Check three things, or issuance will fail:

dig +short example.ru        # should return your machine's address
ss -tulpn | grep -E ':80|:443'
  • the domain's A record points to the address on the “Overview” tab of the control panel at /hosting/vds/m/<id>;
  • port 80 is reachable from outside — Let's Encrypt uses it to verify domain ownership;
  • a web server is running: Nginx or Apache.

If you use Caddy, you don't need to do anything — it issues certificates on its own.

Issuance

apt install -y certbot python3-certbot-nginx      # Debian, Ubuntu
dnf install -y certbot python3-certbot-nginx      # AlmaLinux, CentOS Stream

certbot --nginx -d example.ru -d www.example.ru

For Apache, it's the same path with python3-certbot-apache and the --apache flag. Certbot adds the certificate block and the HTTP-to-HTTPS redirect to the config itself.

Check the result:

certbot certificates
curl -I https://example.ru

Auto-renewal

The package installs a system timer, which also handles renewal. Make sure the timer is active and run a test renewal:

systemctl list-timers | grep certbot
certbot renew --dry-run

A dry run is mandatory. It catches the situation where renewal will break two months from now — for example, you renamed the site config and certbot no longer knows where to put the verification file.

When port 80 is taken

If an application is running on port 80 and you can't put a web server there, use a separate mode:

certbot certonly --standalone --preferred-challenges http -d example.ru

Certbot will spin up its own temporary server for the duration of the check. To do that, you'll have to stop the application: --pre-hook and --post-hook can do it automatically.

After issuance, the certificates are in /etc/letsencrypt/live/example.ru/: fullchain.pem and privkey.pem.

Common errors

SymptomCause
Timeout during connectPort 80 is blocked by the firewall, or the domain points to a different machine
too many certificates already issuedYou've hit the weekly limit for the domain — wait or debug with --staging
The site serves the old certificate after issuanceYou didn't reload the web server: systemctl reload nginx
The certificate has expiredThe timer is disabled — check systemctl enable --now certbot.timer

The /etc/letsencrypt directory is part of your data. There are no automatic backups of the machine, so include it in your backup along with your web server configs.