HTTPS is no longer optional. Browsers label plain-HTTP pages as "Not secure", login forms and payment flows require encryption, and HTTP/2 is only used by browsers over TLS. On a VPS you control the web server yourself, so you are responsible for getting and renewing certificates. The good news is that Let's Encrypt issues trusted certificates for free, and Certbot automates almost the entire process.
This guide walks through the complete setup on Ubuntu or Debian with Nginx or Apache, explains what Certbot changes on your server, and covers renewal, wildcard certificates, Cloudflare and the errors people hit most often.
How Let's Encrypt and Certbot Work
Let's Encrypt is a free, automated certificate authority. Before it issues a certificate it must confirm that you control the domain. This is done with an ACME challenge. Certbot is the most widely used ACME client: it requests the certificate, completes the challenge, saves the files and (optionally) edits your web server configuration.
There are two challenge types you will use on a VPS:
- HTTP-01: Let's Encrypt fetches a token from
http://your-domain/.well-known/acme-challenge/on port 80. This is the default and works for normal (non-wildcard) certificates. Port 80 must be reachable from the internet. - DNS-01: you prove control by creating a TXT record under
_acme-challenge.your-domain. This is the only way to get a wildcard certificate (*.example.com) and it works even when port 80 is closed.
Certificates are currently valid for 90 days. Certbot renews them automatically when they are within 30 days of expiry, so once renewal is configured you rarely need to touch it. Let's Encrypt has announced plans to shorten certificate lifetimes further over time, which makes automatic renewal even more important than manual processes.
Prerequisites
- A Linux VPS with a public IPv4 address (Ubuntu 22.04/24.04 or Debian 12 are used in the examples) and a user with
sudo. - A registered domain name and access to its DNS settings.
- Nginx or Apache installed and serving your site over HTTP.
- Ports 80 and 443 open in any firewall in front of the server.
Step 1: Point Your Domain at the VPS
Create an A record for the root domain and, if you use it, the www host, both pointing to your VPS IPv4 address. If your server also has IPv6, add matching AAAA records; otherwise do not create AAAA records at all, because Let's Encrypt prefers IPv6 and validation fails if an AAAA record points somewhere that does not answer.
example.com. A 203.0.113.10
www.example.com. A 203.0.113.10
Wait for the record to propagate, then confirm it from your own computer:
dig +short example.com A
dig +short www.example.com A
Both commands should return your VPS IP. You can also check propagation with our DNS lookup tool.
Step 2: Open Ports 80 and 443
If you use UFW, allow both web ports. Nginx and Apache install application profiles that make this one line:
# Nginx
sudo ufw allow 'Nginx Full'
# Apache
sudo ufw allow 'Apache Full'
sudo ufw status
Keep port 80 open even after HTTPS works. HTTP-01 renewals need it, and visitors who type the bare domain still arrive on port 80 before being redirected. If you are new to UFW, follow our UFW firewall guide first so you do not lock yourself out of SSH.
Step 3: Install Certbot
The Certbot project recommends installing it as a snap, which always gives you a current version and sets up automatic renewal:
sudo apt update
sudo apt install -y snapd
sudo snap install core
sudo snap install --classic certbot
sudo ln -s /snap/bin/certbot /usr/bin/certbot
If you prefer distribution packages, Ubuntu and Debian ship Certbot and its web server plugins in their repositories:
# Nginx
sudo apt install -y certbot python3-certbot-nginx
# Apache
sudo apt install -y certbot python3-certbot-apache
Use one method, not both. Two installs create two renewal timers and confusing paths.
Step 4: Issue the Certificate (Nginx)
Certbot's Nginx plugin finds the server block whose server_name matches your domain, so make sure that directive is set correctly first:
server {
listen 80;
server_name example.com www.example.com;
root /var/www/example.com;
index index.html index.php;
}
sudo nginx -t && sudo systemctl reload nginx
sudo certbot --nginx -d example.com -d www.example.com
On the first run Certbot asks for an email address (used for important account notices) and for acceptance of the subscriber agreement. It then:
- Completes the HTTP-01 challenge through Nginx.
- Saves the certificate in
/etc/letsencrypt/live/example.com/. - Adds
listen 443 ssl,ssl_certificateandssl_certificate_keylines to your server block. - Adds a permanent redirect from HTTP to HTTPS (current Certbot versions do this by default).
- Reloads Nginx.
The files you will see referenced are:
| File | Purpose |
|---|---|
fullchain.pem | Your certificate plus the intermediate chain. Use this as the server certificate. |
privkey.pem | The private key. Never share it or commit it to Git. |
cert.pem / chain.pem | The certificate and chain separately, for software that needs them split. |
The files in live/ are symlinks that Certbot updates on every renewal, so always reference these paths rather than copying the files elsewhere.
Step 4 (Alternative): Issue the Certificate (Apache)
The process is the same with the Apache plugin. Confirm that your virtual host has the correct ServerName and ServerAlias, then run:
sudo apachectl configtest
sudo certbot --apache -d example.com -d www.example.com
Certbot creates an SSL virtual host (usually example.com-le-ssl.conf), enables mod_ssl if needed and adds the redirect.
Step 5: Verify the Certificate
curl -I https://example.com
curl -I http://example.com # should return 301 to https://
sudo certbot certificates # lists domains and expiry dates
echo | openssl s_client -connect example.com:443 -servername example.com 2>/dev/null | openssl x509 -noout -dates -issuer
The last command shows the validity dates and confirms the issuer is Let's Encrypt. Open the site in a browser and check that the padlock shows no mixed-content warnings. If the browser still warns, the page is loading images or scripts over http://; change those URLs to https:// or to relative paths.
Step 6: Confirm Automatic Renewal
Both installation methods create a systemd timer that runs certbot renew twice a day. Check that it exists and test renewal without touching your real certificate:
# snap install
systemctl list-timers | grep -i certbot
# apt install
systemctl status certbot.timer
sudo certbot renew --dry-run
A successful dry run means renewal will work. With the Nginx and Apache plugins, Certbot reloads the web server after renewing. If you used --standalone or --webroot, or another service (a mail server, a Node.js app terminating TLS itself) reads the certificate, add a deploy hook so it picks up the new files:
sudo certbot renew --deploy-hook "systemctl reload nginx"
Certbot stores the hook in the domain's renewal file under /etc/letsencrypt/renewal/, so future automatic renewals use it too.
Wildcard Certificates with DNS-01
Use a wildcard certificate when you serve many subdomains, for example per-customer subdomains in a SaaS app. Wildcards require the DNS-01 challenge:
sudo certbot certonly --manual --preferred-challenges dns \
-d example.com -d '*.example.com'
Certbot shows a TXT value to add at _acme-challenge.example.com. Manual mode cannot renew automatically, because you must create the record by hand each time. For unattended renewal, install the DNS plugin for your provider (for example certbot-dns-cloudflare) and give it an API token restricted to editing DNS for that zone. Store the credentials file with chmod 600.
Using Let's Encrypt Behind Cloudflare
If your domain is proxied through Cloudflare (orange cloud), visitors see Cloudflare's certificate, but you should still encrypt the connection between Cloudflare and your VPS. Install a Let's Encrypt certificate on the origin as above and set Cloudflare's SSL/TLS mode to Full (strict). Avoid "Flexible" mode: it sends traffic to your server unencrypted and, combined with an HTTP-to-HTTPS redirect on the origin, causes an endless redirect loop.
Optional Hardening: HSTS and Modern TLS
Certbot's default configuration (/etc/letsencrypt/options-ssl-nginx.conf) already disables obsolete protocols. Once you are sure every subdomain works over HTTPS, you can add an HSTS header so browsers never try plain HTTP again:
add_header Strict-Transport-Security "max-age=31536000" always;
Start without includeSubDomains and preload. HSTS is cached by browsers for the whole max-age, so a mistake cannot be undone quickly.
SkyRainCloud Plans for This Workload
TLS adds very little CPU load on modern processors, so HTTPS does not change which plan you need. Size the server for your application; the entry 2 vCore / 8 GB plans comfortably serve HTTPS for business websites and APIs.
Intel Xeon Platinum 8269CY VPS
KVM VPS on Intel Xeon Platinum 8269CY (up to 3.80 GHz Turbo) with DDR4 ECC memory, NVMe SSD, full root access and an unmetered 1 Gbps port.
| Plan | vCores | RAM | Storage | Network | Price | Good for | Buy |
|---|---|---|---|---|---|---|---|
| VPS 1 — Intel | 2 | 8 GB DDR4 ECC | 40 GB NVMe SSD | 1 Gbps, unmetered | ₹649/month | Business websites, small apps, scheduled jobs and bots | Order |
| VPS 2 — Intel | 4 | 16 GB DDR4 ECC | 80 GB NVMe SSD | 1 Gbps, unmetered | ₹1,169/month | Business software, mid-size databases, several sites on one server | Check stock |
| VPS 3 — Intel | 8 | 32 GB DDR4 ECC | 150 GB NVMe SSD | 1 Gbps, unmetered | ₹2,249/month | ERP/CRM stacks, heavier databases, multiple production apps | Check stock |
| VPS 4 — Intel | 16 | 64 GB DDR4 ECC | 250 GB NVMe SSD | 1 Gbps, unmetered | ₹4,299/month | High-memory workloads and consolidated production servers | Check stock |
AMD EPYC 7C13 VPS
Dedicated KVM vCores on AMD EPYC 7C13 (up to 3.70 GHz) with DDR4 ECC memory, NVMe SSD and an unmetered 1 Gbps port.
| Plan | vCores | RAM | Storage | Network | Price | Good for | Buy |
|---|---|---|---|---|---|---|---|
| VPS 1 — AMD | 2 | 8 GB DDR4 ECC | 40 GB NVMe SSD | 1 Gbps, unmetered | ₹649/month | Websites, small APIs, bots, staging and VPN servers | Order |
| VPS 2 — AMD | 4 | 16 GB DDR4 ECC | 80 GB NVMe SSD | 1 Gbps, unmetered | ₹1,299/month | WooCommerce, Node.js/Python backends, Docker Compose stacks, CI runners | Order |
| VPS 3 — AMD | 8 | 32 GB DDR4 ECC | 150 GB NVMe SSD | 1 Gbps, unmetered | ₹2,499/month | Production databases, high-traffic sites, multi-container apps | Order |
| VPS 4 — AMD | 16 | 64 GB DDR4 ECC | 250 GB NVMe SSD | 1 Gbps, unmetered | ₹4,899/month | Large production workloads, SaaS platforms, analytics, in-memory caches | Order |
Prices are monthly in INR as listed on the SkyRainCloud store (verified 2026-11-14). Stock and final pricing are shown on the product page at checkout.
Common Errors and How to Fix Them
| Error | Likely cause | Fix |
|---|---|---|
| Timeout during connect / connection refused | Port 80 blocked by UFW, a cloud firewall or nothing listening | Open port 80, make sure Nginx/Apache is running, test with curl -I http://example.com from outside |
| NXDOMAIN or "DNS problem" | A record missing or not yet propagated | Check with dig; wait for propagation |
| Invalid response from IPv6 address | An AAAA record points to a host that does not serve the site | Remove the AAAA record or configure IPv6 on the VPS |
| Could not automatically find a matching server block | server_name does not list the domain | Fix server_name, reload Nginx, run Certbot again |
| too many certificates already issued | Hit a Let's Encrypt rate limit after repeated attempts | Use --dry-run or --staging while testing; wait for the limit window to reset |
| ERR_TOO_MANY_REDIRECTS | Cloudflare "Flexible" SSL plus origin redirect | Switch Cloudflare to Full (strict) |
When experimenting, add --staging (or --test-cert) to issue certificates from Let's Encrypt's staging environment, which has much higher limits. Staging certificates are not trusted by browsers, so re-run without the flag once everything works.
Quick Checklist
- A (and only valid AAAA) records point to the VPS.
- Ports 80 and 443 are open.
- Certbot installed by one method only.
certbot --nginxor--apachecompleted and HTTP redirects to HTTPS.certbot renew --dry-runsucceeds.- No mixed-content warnings in the browser.
Frequently Asked Questions
Is a Let's Encrypt certificate as secure as a paid SSL certificate?
How long does a Let's Encrypt certificate last?
Do I need to keep port 80 open after enabling HTTPS?
Can I get one certificate for several domains?
-d flags, for example -d example.com -d www.example.com -d shop.example.com. Each name must point to the server. A wildcard certificate (*.example.com) needs the DNS-01 challenge.How do I renew a Let's Encrypt certificate manually?
sudo certbot renew. It only renews certificates close to expiry; add --force-renewal to renew immediately, but use that sparingly because of rate limits.Will HTTPS slow down my VPS?
Does Certbot work with Node.js, Python or Docker apps?
certbot --nginx. If the app terminates TLS itself, use certbot certonly and point the app at fullchain.pem and privkey.pem with a deploy hook to restart it.How do I use Let's Encrypt with Cloudflare?
What happens if renewal fails?
sudo certbot renew --dry-run to see the error; the usual causes are a closed port 80, changed DNS or a modified server block.