Certbot is an open-source command-line client that automates obtaining, installing, and renewing free SSL/TLS certificates from Let’s Encrypt. With a few commands, you can enable HTTPS on a domain and keep it valid without manual intervention. This guide covers installation and practical usage on Nginx or Apache.
What Certbot Does
Certbot uses the ACME (Automatic Certificate Management Environment) protocol to prove domain control and request a certificate. It can integrate directly with web servers like Nginx or Apache, or run in standalone mode independent of a web server. The issued certificate chains to the Let’s Encrypt root that browsers trust, so there’s no extra cost or third-party validation step.
Why Use Certbot?
- Free and open source, with no license fees.
- Automates the renewal process, eliminating manual certificate handling.
- Provides ready-to-use plugins for Nginx, Apache, and many other web servers.
- Supports DNS-based validation for wildcard certificates.
- Actively maintained by the EFF and the open source community.
On our virtual servers, you get full root access, which makes Certbot the standard choice for managing SSL in production. If you are still deciding on the right server for your website, our server buying guide can help you choose the right resources.
Installation
Ubuntu / Debian
On Ubuntu 22.04 and later, you can install Certbot directly from the apt repositories:
sudo apt update
sudo apt install certbot python3-certbot-nginx
If you use Apache, install python3-certbot-apache instead. To obtain a certificate and automatically update your Nginx configuration:
sudo certbot --nginx -d example.com -d www.example.com
This command performs domain validation on port 80 and adds an HTTPS redirect to your Nginx setup. For a more detailed walkthrough, see our Certbot SSL Setup and Automatic Renewal guide.
AlmaLinux / Rocky Linux 9
On RHEL-based distributions, first enable the EPEL repository:
sudo dnf install epel-release -y
sudo dnf install certbot python3-certbot-nginx -y
Then use the same certbot --nginx command. If the plugin package is not available, you can generate a certificate in standalone mode:
sudo certbot certonly --standalone -d example.com
The certificate is saved under /etc/letsencrypt/live/example.com/, and you can reference that path directly in your Nginx or Apache configuration.
Renewal and Automation
Package installation typically sets up a systemd timer or cron job that runs twice daily. Renewal only occurs when a certificate is close to expiry, so you do not need to intervene. To verify that automatic renewal is active:
sudo systemctl status certbot.timer
or run a dry test:
sudo certbot renew --dry-run
The --dry-run option performs all steps without issuing a real renewal, helping you catch configuration errors early.
Common Errors and Fixes
- Port 80 closed: ACME HTTP-01 validation requires port 80. Make sure it is open in your firewall and any cloud security group.
- Missing or incorrect DNS record: The domain must resolve to your server’s IP address via an A or AAAA record.
- Rate limit exceeded: Too many attempts for the same domain can hit Let’s Encrypt’s weekly limit. Wait and retry later.
- Web server not running: If Nginx or Apache is inactive, plugin-based validation fails. Check with
sudo systemctl status nginxorsudo systemctl status apache2.
Conclusion
Certbot makes TLS certificate management practical from the command line. Instead of dealing with manual certificate issuance and renewal, a few commands handle both installation and continuous updates. We use Certbot extensively on our infrastructure and help customers keep their sites running with uninterrupted HTTPS.