This Let’s Encrypt setup guide gives you a reusable checklist for issuing, installing, testing, and renewing a free SSL/TLS certificate with Certbot. It covers common Linux web-server scenarios, domain validation, HTTPS redirects, renewal checks, and the mistakes that most often cause failed deployments.
Overview
Let’s Encrypt certificates enable encrypted HTTPS connections between a visitor’s browser and your website. The certificate is only one part of a secure deployment: your domain must resolve to the correct server, the validation challenge must be reachable, your web server must present the certificate correctly, and renewal must be tested before the first certificate expires.
Certbot is a commonly used client for requesting certificates and configuring supported web servers. The exact installation command depends on your operating system, hosting provider, web server, and package-management method. Before copying commands, confirm which operating system and server software you are using. Avoid mixing instructions intended for a control panel, a managed host, and a self-administered VPS.
A typical setup follows this order:
- Point the domain and any required subdomains to the intended server.
- Confirm that the server answers over HTTP on port 80 and, after installation, HTTPS on port 443.
- Install Certbot and the appropriate web-server integration.
- Request a certificate and complete domain validation.
- Test HTTPS, redirects, application behavior, and renewal.
For a broader VPS deployment sequence, see Secure HTTPS Setup on a New VPS. If you are comparing ACME clients rather than choosing Certbot, review Certbot vs acme.sh vs lego.
Checklist by scenario
Before you request a certificate
- List every hostname that should be covered, such as
example.comandwww.example.com. A certificate for one hostname does not automatically cover every other hostname. - Check the A and AAAA records. An incorrect IPv6 record can send validation traffic to a different server even when the IPv4 address is correct.
- Make sure the site is publicly reachable. Local-only hostnames, private addresses, and domains blocked by network policy cannot complete ordinary HTTP validation.
- Allow inbound TCP traffic on ports 80 and 443 when using HTTP-based validation and normal HTTPS service.
- Back up web-server configuration before allowing Certbot to edit it.
Operating-system and web-server comparison
| Environment | Typical workflow | Important checks |
|---|---|---|
| Ubuntu or Debian VPS with Nginx | Install Certbot and its Nginx integration, then run Certbot for the selected server block. | Confirm the server block has the correct domain names and that Nginx configuration passes a syntax test. |
| Ubuntu or Debian VPS with Apache | Install Certbot and its Apache integration, then request the certificate for the configured virtual host. | Check the enabled virtual host, modules, rewrite behavior, and Apache configuration syntax. |
| Other Linux distributions | Use the distribution’s documented Certbot package or an approved installation method for that system. | Do not assume Ubuntu package commands or file paths apply to another distribution. |
| cPanel or Plesk | Use the control panel’s certificate and renewal workflow unless the provider documents another method. | Avoid manually editing panel-managed files; confirm renewal from the panel. |
| DNS-only or unusual hosting | Use a DNS-01 challenge, often through a DNS provider integration or carefully managed TXT records. | Protect DNS API credentials and remove temporary validation records when appropriate. |
Nginx installation path
On a Debian- or Ubuntu-family VPS, the package names and installation method may vary by release. After installing Certbot and the Nginx plugin through your system’s supported package method, a common command is:
sudo certbot --nginx -d example.com -d www.example.comCertbot may offer to update the Nginx configuration and redirect HTTP traffic to HTTPS. Review the proposed change rather than accepting it blindly. If you manage the configuration yourself, you can request only the certificate and configure the server blocks manually:
sudo certbot certonly --nginx -d example.com -d www.example.comBefore and after changes, validate Nginx configuration with the command appropriate to your installation, commonly sudo nginx -t, then reload the service rather than restarting it unnecessarily.
Apache installation path
After installing Certbot and the Apache integration using the package method supported by your operating system, a common command is:
sudo certbot --apache -d example.com -d www.example.comAs with Nginx, use certonly if you want to install the certificate manually. Confirm the correct Apache virtual host is enabled and test the configuration before reloading Apache. A typical configuration check is sudo apachectl configtest, but the command can differ by distribution.
DNS-01 validation
DNS-01 is useful when the web server is not publicly reachable on port 80 or when you need a certificate for a hostname that is not serving a public website. The validation process requires a specific TXT record under the domain. Add the record exactly as instructed, allow DNS changes time to become visible, and avoid deleting an existing TXT record that serves another purpose. For delegation, DNSSEC, and TXT-record considerations, see DNSSEC and Let’s Encrypt DNS-01.
Renewal checklist
Certificates are issued for a limited period, so installation is not complete until automated renewal works. Common checks include:
sudo certbot renew --dry-run
sudo systemctl list-timers | grep -i certbot
sudo certbot certificatesThe exact renewal scheduler may be a systemd timer, a cron job, a hosting-panel task, or another service. The dry run tests the renewal workflow without replacing the live certificate. Also verify that the web server reloads successfully after renewal and that monitoring will alert you if renewal fails.
What to double-check
- Certificate names: Inspect the certificate and confirm that every required hostname appears in its subject alternative names. Test both the apex domain and the
wwwhostname if both are used. - DNS answers: Query A and AAAA records from more than one network or use a DNS inspection tool. Cached answers can hide a recent correction.
- Port access: Check the cloud firewall, host firewall, router, and web server. Opening a port in only one layer is not enough.
- Redirects: Choose one canonical HTTPS hostname and redirect HTTP traffic to it. Test that redirects do not loop between a proxy and the origin server.
- Proxy arrangements: If a CDN or reverse proxy sits in front of the origin, understand where TLS terminates and whether the origin also needs a certificate.
- Mixed content: Update images, scripts, stylesheets, fonts, and API URLs that still use HTTP. A valid certificate does not make insecure page resources secure.
- Permissions: Keep private key files readable only by the services and administrators that require access. Do not paste private keys into tickets, repositories, or public configuration examples.
- Application behavior: Test logins, forms, webhooks, cookies, redirects, and API clients after enabling HTTPS.
Common mistakes
Running Certbot before DNS is ready
If the hostname points to the wrong server, validation fails or a certificate is issued for an unintended service. Confirm DNS first and include all relevant records, especially IPv6.
Blocking port 80
Many HTTP-based validation attempts require the authority to reach the domain over port 80. A blanket redirect to HTTPS is generally compatible when the web server answers correctly, but a firewall rule, authentication wall, maintenance page, or proxy error can still prevent validation.
Using the wrong virtual host
Multiple sites on one server can make it easy to edit the wrong Nginx server block or Apache virtual host. Confirm the domain-to-site mapping before requesting or installing the certificate.
Editing managed configuration manually
Control panels and hosting platforms may regenerate web-server files. Use the platform’s documented workflow or your manual changes may disappear during an update or renewal.
Testing renewal only in production
Repeated live requests can create unnecessary failures and may encounter issuance limits. Use certbot renew --dry-run and, when developing an automation workflow, use the ACME staging environment. See Let’s Encrypt Rate Limits Explained.
Forgetting non-browser clients
Browsers may follow redirects and recover from some configuration issues that break payment callbacks, mobile apps, monitoring probes, or server-to-server requests. Test the clients that matter to your site.
When to revisit
Revisit this checklist whenever you add a domain or subdomain, move hosting providers, change DNS, replace Nginx or Apache configuration, introduce a CDN, rotate DNS credentials, or migrate from shared hosting to a VPS. It is also worth reviewing before a planned deployment or seasonal traffic cycle, when a certificate renewal failure would be harder to diagnose.
After any change, run this short verification sequence:
- Confirm A, AAAA, and any DNS-01 TXT records.
- Check certificate names and expiration from an external network.
- Test HTTP-to-HTTPS and canonical-host redirects.
- Load important pages and exercise forms, logins, APIs, and webhooks.
- Run the renewal dry test and confirm the scheduler is active.
- Review web-server logs for validation, permission, handshake, and reload errors.
Keep a small deployment record containing the hostnames, DNS provider, web server, certificate method, renewal scheduler, and rollback location. That record turns the next Let’s Encrypt setup into a controlled repeatable task rather than an emergency investigation. For managed hosting workflows, see Let’s Encrypt on cPanel and Plesk; for certificate errors, use the certificate troubleshooting guide.