Skip to content

Tutorials Security Intermediate1 min read

How to Install a Free Let's Encrypt SSL Certificate with Certbot

Secure an Nginx or Apache site on your VPS with a free Let's Encrypt certificate using Certbot, including automatic renewal and HTTPS redirects.

By ZSOLNET Editorial Team Updated

Key takeaways

  • Certbot obtains, installs and renews Let's Encrypt certificates automatically.
  • DNS must point at the server before you request a certificate.
  • Certificates last 90 days; renewal runs on a timer.

Before you start

  • Your domain’s A records (both example.com and www) point to the server.
  • Ports 80 and 443 are open: sudo ufw allow 'Nginx Full' or sudo ufw allow 'Apache Full'.
  • The web server has a site configured for the domain.

1. Install Certbot

The Certbot project recommends the snap package:

sudo snap install --classic certbot
sudo ln -s /snap/bin/certbot /usr/bin/certbot

2. Request and install the certificate

For Nginx:

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

For Apache, use --apache instead. Enter an email for expiry notices and agree to the terms. Certbot edits your configuration and sets up the HTTP-to-HTTPS redirect.

3. Confirm renewal works

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

4. Verify

Run the SSL checker on your domain. It should show a valid certificate, the full chain and TLS 1.2/1.3.

Frequently asked questions

Why does Certbot fail with a challenge error?

Let's Encrypt couldn't reach your server over HTTP on port 80 for that hostname. Check the A record, open port 80 in the firewall, and make sure no CDN or redirect is interfering.

Can I get a wildcard certificate?

Yes, but wildcards require the DNS-01 challenge, which means adding a TXT record — manually or with a DNS provider plugin.

Share X LinkedIn Facebook

Log in to your account

Manage your domains, hosting and invoices in one place.

Secure connection straight to the ZSOLNET client area.

Open the ZSOLNET dashboard

No account yet?