Certbot is the recommended client for obtaining free SSL/TLS certificates from Let’s Encrypt. This guide covers installation, certificate issuance for Apache and Nginx, standalone mode, wildcard certificates, and automated renewal.
This guide is for VPS and Bare Metal customers managing their own web servers. Web Hosting (Plesk) and WordPress Hosting customers have Let’s Encrypt built into their control panels and do not need Certbot.
If you are not running a web server, or prefer not to let Certbot modify your configuration, use standalone mode. Certbot temporarily starts its own web server on port 80 to complete the HTTP-01 challenge.
# Stop your web server first if it is using port 80systemctl stop nginx # or apache2 / httpdcertbot certonly --standalone -d example.com -d www.example.com# Start your web server againsystemctl start nginx # or apache2 / httpd
Standalone mode only obtains the certificate — you must configure your web server to use it manually. Certificates are stored in /etc/letsencrypt/live/example.com/.
File
Purpose
fullchain.pem
Certificate + intermediate chain (use this for ssl_certificate in Nginx or SSLCertificateFile in Apache)
privkey.pem
Private key (use this for ssl_certificate_key in Nginx or SSLCertificateKeyFile in Apache)
Wildcard certificates (*.example.com) require DNS-01 validation instead of HTTP-01. This means Certbot needs to create a TXT record in your DNS zone to prove ownership.
certbot certonly --manual --preferred-challenges dns -d example.com -d "*.example.com"
Certbot will prompt you to create a TXT record at _acme-challenge.example.com with a specific value. Add the record in your DNS provider, wait for propagation, then press Enter to continue.
Wildcard certificates require manual DNS intervention on each renewal unless you automate it with a DNS plugin (e.g., certbot-dns-cloudflare, certbot-dns-route53). If you cannot automate DNS challenges, consider using individual certificates per subdomain instead.
Certbot supports hooks that run after a successful renewal. This is useful for reloading your web server or restarting services that depend on the certificate.
# Reload Nginx after renewalcertbot renew --deploy-hook "systemctl reload nginx"# Reload Apache after renewalcertbot renew --deploy-hook "systemctl reload apache2"# Run a custom scriptcertbot renew --deploy-hook "/opt/scripts/post-renew.sh"
To make a deploy hook permanent, create a script in /etc/letsencrypt/renewal-hooks/deploy/:
“Problem binding to port 80” — Another service is already using port 80. Stop your web server before using standalone mode, or use the Nginx/Apache plugin instead.
“DNS problem: NXDOMAIN” — The domain does not resolve to your server. Verify your A/AAAA records point to the correct IP and that DNS has propagated.
“Too many certificates already issued” — Let’s Encrypt has rate limits of 50 certificates per registered domain per week. Use --staging for testing to avoid hitting production limits.
“Unauthorized” during renewal — If your server is behind Cloudflare with proxying enabled, ensure HTTP-01 challenges can reach your origin server. Alternatively, switch to DNS-01 validation.