15 min read
Free SSL certificate: Let's Encrypt and nginx
In one sentence: To have HTTPS with no warnings, your server needs a name and a certificate signed by an authority the browser knows. With a domain, Let's Encrypt gives you one for free: it checks over port 80 that the name points to your server, and certbot installs it in nginx and renews it on its own. With no domain, you sign the certificate yourself with your own authority, and only your computer trusts it.
What you will learn
- Point a domain to your server with A and AAAA records, and know what its TTL does.
- Explain how Let's Encrypt checks that the domain is yours, and why it needs port 80.
- Create your own certificate authority with openssl, sign the shop's certificate with it and install it in nginx.
- Read a certificate's chain with openssl s_client, and understand the browser's warning.
Before you start, read: 04-reverse-proxy.md
The problem
Section titled “The problem”At the end of lesson 4, the shop answers over HTTPS, but only with curl -k, which skips the certificate check. Marta opens the address in her browser and sees a red screen: “Your connection is not private.” She isn’t going to buy there.
The provisional certificate claims to be for shop.example, a name that doesn’t point to your server, and nobody the browser knows signed it. Two things are missing: a real name and a signature to trust.
The analogy
Section titled “The analogy”The analogy
Think of opening a shop on a street. First, an address that shows up on the maps: the domain. Then, a seal on the door from a body everyone knows: “these premises belong to who they say.”
That body, Let’s Encrypt, doesn’t ask you for papers: it gives you a code and comes by to see whether you’ve put it in the window. If it’s there, you control the premises.
With no address on the maps, like your virtual machine, you make your own seal. It’s valid at home, where they know it; a stranger has no reason to believe it.
Where the analogy breaks down
- The body doesn’t check who you are or whether your shop is honest: only that you control the address. A scam website can have a padlock too.
- A shop’s seal lasts for years. A Let’s Encrypt certificate lasts 90 days, and a program renews it without you noticing.
How it really works
Section titled “How it really works”A name: the domain and its records
Section titled “A name: the domain and its records”A Domain nameThe name of a website or a server, such as example.com, which you buy by the year from a registrar. Whoever holds it decides, with its DNS records, which IP address it points to.Go to definition, like shop.example, is bought by the year from a registrar: Cloudflare Registrar, Porkbun or Namecheap, for example. Prices change: on October 17, 2026, a .com cost $11.08 a year at Porkbun.
From its dashboard you decide where it points, with the DNS recordDNS stands for Domain Name System.A piece of data a domain publishes in the DNS, with a type: A (an IPv4 address), AAAA (an IPv6 address), CNAME (an alias for another name), MX (the mail server), TXT (free text) or NS (its DNS servers).Go to definition you saw in Phase 0:
| Name | Type | Value | TTL |
|---|---|---|---|
shop.example |
A | 203.0.113.10, your server’s IPv4 |
300 |
shop.example |
AAAA | 2001:db8::10, its IPv6, if it has one |
300 |
The TTL (in DNS)TTL stands for time to live.The number of seconds a DNS answer may be kept in a cache before asking again. It has nothing to do with the TTL of IP packets, which counts how many routers they may go through.Go to definition is the number of seconds each cache can keep the answer. While you’re setting up the server, keep it low (300, five minutes): if you get the IP wrong, the fix arrives soon. It’s the false “propagation” from Phase 0.
How Let’s Encrypt knows the domain is yours
Section titled “How Let’s Encrypt knows the domain is yours”Let’s EncryptA nonprofit certificate authority that gives out certificates for free and automatically. Before signing one, it checks with the ACME protocol that whoever asks for it controls the domain.Go to definition is the free, automatic certificate authority we promised you in Phase 0. It talks to a program on your server, certbot, through a protocol, ACMEACME stands for Automatic Certificate Management Environment.The protocol a program on your server, such as certbot, uses to ask a certificate authority like Let’s Encrypt for a certificate, prove that it controls the domain (for example, by publishing a file on port 80) and renew it without you stepping in.Go to definition. The most common check is called HTTP-01:
- Let's Encrypt → certbot (your server)Publish this answer for the token TOKEN
- nginx, port 80 (your server) → Let's EncryptThe answer
- Let's Encrypt → certbot (your server)The certificate, signed
Let’s Encrypt asks for the file from the internet: if it gets it, whoever asks for the certificate controls the name’s server. And it always starts on port 80, over http. Let’s Encrypt’s documentation puts it like this: “The HTTP-01 challenge can only be done on port 80.”
That’s why the shop’s site leaves that path out of the redirect:
# Port 80: everything is redirected to HTTPS, except the challenge Let's Encrypt uses to check that# the domain is yours (certbot answers it; lesson 5).server { listen 80; listen [::]:80; server_name shop.example;
location /.well-known/acme-challenge/ { root /var/www/html; }
location / { return 301 https://$host$request_uri; }}Whatever asks for /.well-known/acme-challenge/ is looked up in /var/www/html; everything else is redirected. That way the challenge doesn’t depend on 443. While it lasts, certbot also adds its own answer, and removes it when it’s done.
The CSRCSR stands for Certificate Signing Request.The request sent to a certificate authority for it to sign a certificate. It carries the server’s public key and the names it must cover, signed with its private key, which never leaves the server.Go to definition (Certificate Signing Request) is the request for a signature: your public key and the names the certificate must cover. The private key never leaves your server.
certbot: request, install and renew
Section titled “certbot: request, install and renew”With sudo certbot --nginx -d shop.example, certbot does all of that and also changes your nginx site. It looks for the block with server_name shop.example and replaces the two certificate lines with Let’s Encrypt’s, which the file already has commented out:
# Port 443: HTTPS, and the shop behind (the block goes on: what follows is inside it).server { listen 443 ssl; listen [::]:443 ssl; http2 on; server_name shop.example;
# The server's certificate and its key. In lesson 4, a provisional self-signed one (curl -k); # lesson 5 replaces it with one signed by your own certificate authority (openssl). That way it # works without a domain: the browser warns because it doesn't know that authority, and curl # --cacert accepts it. ssl_certificate /etc/ssl/shop/shop.crt; ssl_certificate_key /etc/ssl/shop/shop.key; # With a domain and Let's Encrypt, certbot --nginx replaces the two lines above with these (or # you replace them), with your domain's name in the folder: # ssl_certificate /etc/letsencrypt/live/shop.example/fullchain.pem; # ssl_certificate_key /etc/letsencrypt/live/shop.example/privkey.pem;fullchain.pem: your certificate and, behind it, the one of the intermediate authority that signed it. The browser needs both to reach a root on its list.privkey.pem: the private key, which onlyrootreads.
Let’s Encrypt’s certificates last 90 days in October 2026, and will go down to 64 in February 2027 and to 45 in 2028, according to its schedule. Nobody renews them by hand: certbot installs a systemd timer that tries twice a day and only renews the ones that expire soon.
Why your VM can’t have one
Section titled “Why your VM can’t have one”Your VM has a Private IP addressIP stands for Internet Protocol.An IP address that only works inside a local network, such as 192.168.1.133. The same ones are reused in millions of homes, and they can’t be reached from the internet.Go to definition: nobody on the internet can reach it. We tried it on the VM the outputs come from, with certbot certonly --dry-run, which uses Let’s Encrypt’s test servers: it doesn’t save a certificate, but it registers a test account there:
Certbot failed to authenticate some domains (authenticator: nginx). The Certificate Authority reported these problems: Identifier: 192-168-5-15.sslip.io Type: dns Detail: no valid A records found for 192-168-5-15.sslip.io; no valid AAAA records found for 192-168-5-15.sslip.ioIt doesn’t even try: the name points to a private address, and Let’s Encrypt discards it.
Without a domain: sslip.io and your own authority
Section titled “Without a domain: sslip.io and your own authority”For the VM, two free pieces:
- A name: sslip.io is a public DNS server that answers with the IP written in the name:
192-168-5-15.sslip.iois192.168.5.15. Some home routers discard public DNS answers with private IPs (the protection against DNS rebinding: an attack in which a website switches its IP to one on your network so your browser talks to your devices). If it happens to you, plan B is your computer’shostsfile. - An authority: with
opensslyou create a certificate authority, your own, that signs the shop’s certificate. Your computer trusts what it signs if you give it its certificate; Marta’s browser doesn’t.
And lesson 4’s self-signed one? You’d have to hand out every server’s certificate. With an authority, you trust it once and it’s valid for everything it signs, as with the real ones.
Real HTTPS: the redirect and HSTS
Section titled “Real HTTPS: the redirect and HSTS”With the good certificate, two things that were already there start to work:
- The redirect. Whoever types
http://gets a301to the same address withhttps://: port 80’sreturn 301. strict-transport-security, the HSTSHSTS stands for HTTP Strict Transport Security.The Strict-Transport-Security header, with which a site asks the browser to connect to it only over HTTPS for as long as it says, even if you type http:// or follow an old link. The browser only takes it into account if it arrives over HTTPS.Go to definition header the API has sent since Phase 6. We told you it would act with HTTPS: the browser only pays attention to it if it arrives with a valid certificate. From then on, formax-age=15552000seconds (180 days), it goes straight tohttps://.
Try it
Section titled “Try it”The goal: get your computer to talk to the shop over HTTPS without -k, read the certificate’s chain and see what the browser says. Already have a domain and a VPS? Go to With a domain: Let’s Encrypt.
The outputs are from lesson 4’s VM, 192.168.5.15, and from another machine playing your computer. Use your IP with dashes: with 192.168.64.2, your name is 192-168-64-2.sslip.io. Your dates and times will be different.
A name for your VM
Section titled “A name for your VM”On the server, ask a public DNS, Cloudflare’s (1.1.1.1), for the name:
1. sslip.io's A record
dig +noall +answer 192-168-5-15.sslip.io @1.1.1.1What you will see:
192-168-5-15.sslip.io. 3600 IN A 192.168.5.15An A record with your IP and a TTL of 3600 seconds. Nobody registered that name: sslip.io reads it and answers.
Now on your computer, with your network’s DNS:
2. From your computer
dig +short 192-168-5-15.sslip.ioWhat you will see:
192.168.5.15If your IP comes out, go on. If nothing comes out, your router is discarding the answer: go to plan B. On Windows, nslookup 192-168-5-15.sslip.io, which prints more lines.
Plan B: the hosts file
echo "192.168.5.15 192-168-5-15.sslip.io" | sudo tee -a /etc/hostsAdd-Content -Path C:\Windows\System32\drivers\etc\hosts -Value "192.168.5.15 192-168-5-15.sslip.io"What you will see:
192.168.5.15 192-168-5-15.sslip.ioOnly if step 2 gave nothing. Your computer looks at hosts before asking the DNS, so the name works all the same. It needs administrator permissions: on Windows, open PowerShell with “Run as administrator.” Delete that line when you finish the phase.
Your authority and the shop’s certificate
Section titled “Your authority and the shop’s certificate”On the server, create the authority in a folder of its own:
3. The authority
mkdir ~/authority && cd ~/authorityopenssl req -x509 -newkey ec -pkeyopt ec_paramgen_curve:prime256v1 -nodes -days 365 -subj "/CN=Ana's shop authority" -keyout ca.key -out ca.crtls -lWhat you will see:
-----total 8-rw-rw-r-- 1 ubuntu ubuntu 607 Oct 18 02:24 ca.crt-rw------- 1 ubuntu ubuntu 241 Oct 18 02:24 ca.keyThe provisional certificate’s command, with another name and a year of life. ca.key is the key that signs: -rw-------, for you only. ca.crt is the authority’s certificate, the one you’ll hand out.
4. What makes it an authority?
openssl x509 -in ca.crt -noout -subject -issuer -dates -ext basicConstraintsWhat you will see:
subject=CN=Ana's shop authorityissuer=CN=Ana's shop authoritynotBefore=Oct 18 00:24:13 2026 GMTnotAfter=Oct 18 00:24:13 2027 GMTX509v3 Basic Constraints: critical CA:TRUEsubjectandissuerthe same: it signs itself. It’s a root, like the ones your system comes with.CA:TRUE: it can sign other certificates.
Now the shop’s key and its CSR, with the name:
5. The shop's key and its CSR
openssl req -newkey ec -pkeyopt ec_paramgen_curve:prime256v1 -nodes -subj "/CN=192-168-5-15.sslip.io" -addext "subjectAltName=DNS:192-168-5-15.sslip.io" -addext "extendedKeyUsage=serverAuth" -keyout shop.key -out shop.csropenssl req -in shop.csr -noout -subject -verifyWhat you will see:
-----Certificate request self-signature verify OKsubject=CN=192-168-5-15.sslip.ioWithout -x509, openssl req makes a request instead of a certificate.
subjectAltName: where browsers look for the name; only old programs look atCN.extendedKeyUsage=serverAuth: what the certificate is for, identifying a server. macOS and Safari require it on server certificates, and tools like mkcert always add it.-verify: checks that the CSR is signed withshop.key.
6. Your authority signs it
openssl x509 -req -in shop.csr -CA ca.crt -CAkey ca.key -days 90 -copy_extensions copy -out shop.crtopenssl x509 -in shop.crt -noout -subject -issuer -dates -ext subjectAltName,extendedKeyUsageWhat you will see:
Certificate request self-signature oksubject=CN=192-168-5-15.sslip.iosubject=CN=192-168-5-15.sslip.ioissuer=CN=Ana's shop authoritynotBefore=Oct 18 00:24:13 2026 GMTnotAfter=Jan 16 00:24:13 2027 GMTX509v3 Subject Alternative Name: DNS:192-168-5-15.sslip.ioX509v3 Extended Key Usage: TLS Web Server Authentication-CAand-CAkey: sign with your authority.-copy_extensions copycarries the CSR’s extensions over to the certificate: the name and the usage.issueris now your authority, and it expires in 90 days, like a Let’s Encrypt one.
Copy it where nginx looks for it, over the provisional one:
7. To /etc/ssl/shop
sudo cp shop.crt shop.key /etc/ssl/shop/sudo ls -l /etc/ssl/shopWhat you will see:
total 8-rw-r--r-- 1 root root 660 Oct 18 02:24 shop.crt-rw------- 1 root root 241 Oct 18 02:24 shop.keyThe key, -rw-------: for root only. ca.key isn’t copied, because nginx doesn’t need it; and it shouldn’t stay on the server longer than necessary: you’ll delete it before you trust your authority.
nginx, with the new name
Section titled “nginx, with the new name”Go back to /opt/shop and put your name in the two server_name lines:
8. The name in the site
sed -i 's/server_name shop.example;/server_name 192-168-5-15.sslip.io;/' nginx/shop.confgrep -n "server_name" nginx/shop.confWhat you will see:
9:# 1. shop.example, in the two server_name lines, to your name: your domain or, with the free41: server_name 192-168-5-15.sslip.io;59: server_name 192-168-5-15.sslip.io;sed -i changes the file. Line 9 is a comment; 41 and 59, the two server blocks.
9. Install it and reload
sudo cp nginx/shop.conf /etc/nginx/sites-available/shopsudo nginx -t && sudo systemctl reload nginxWhat you will see:
nginx: the configuration file /etc/nginx/nginx.conf syntax is oknginx: configuration file /etc/nginx/nginx.conf test is successfulIf nginx -t says key values mismatch, you copied the key of one certificate and the certificate of another: repeat step 7.
The shop only accepts requests with the session cookie from its own websites, ALLOWED_ORIGINS (Phase 6). Now it has a different name:
10. The shop's origin
sed -i 's|^ALLOWED_ORIGINS=.*|ALLOWED_ORIGINS=https://192-168-5-15.sslip.io|' .envgrep ^ALLOWED_ORIGINS .envdocker compose -f compose.production.yaml up -d apiWhat you will see:
ALLOWED_ORIGINS=https://192-168-5-15.sslip.io…[+] up 4/4…✔ Container shop-api-1 Started 1.9s✔ Container shop-migrate-1 Exited 1.1sup -d api recreates the API so it reads the new .env. Wait a few seconds before the next step: while it starts, nginx answers 502.
From your computer
Section titled “From your computer”On your computer, without -k:
11. Without your authority
curl https://192-168-5-15.sslip.io/healthcurl.exe https://192-168-5-15.sslip.io/healthWhat you will see:
curl: (60) SSL certificate OpenSSL verify result: unable to get local issuer certificate (20)More details here: https://curl.se/docs/sslcerts.html…The name matches now; what fails is the signature: unable to get local issuer certificate, it can’t find whoever signed it on your system. The text changes depending on your system.
Bring over the authority’s certificate, never its key, and give it to curl:
12. With your authority
scp ubuntu@192.168.5.15:authority/ca.crt .curl --cacert ca.crt -i https://192-168-5-15.sslip.io/healthscp ubuntu@192.168.5.15:authority/ca.crt .curl.exe --ssl-no-revoke --cacert ca.crt -i https://192-168-5-15.sslip.io/healthWhat you will see:
ca.crt 100% 607 2.2MB/s 00:00HTTP/2 200server: nginx/1.28.3 (Ubuntu)…strict-transport-security: max-age=15552000; includeSubDomains…x-xss-protection: 0
{"status":"ok"}HTTP/2 200 without -k: curl has checked the chain up to your authority, and the name. It’s the HTTPS Phase 2 promised your VM’s nginx, and with it, HTTP/2. And there’s strict-transport-security: max-age is 180 days, and includeSubDomains extends the rule to every name that ends in yours.
On Windows, --ssl-no-revoke: curl.exe asks whether the certificate has been revoked, and your authority doesn’t publish that list.
13. Over http
curl -i http://192-168-5-15.sslip.io/healthcurl.exe -i http://192-168-5-15.sslip.io/healthWhat you will see:
HTTP/1.1 301 Moved PermanentlyServer: nginx/1.28.3 (Ubuntu)…Location: https://192-168-5-15.sslip.io/health…The 301, now to a name with a valid certificate.
The chain, and what the browser says
Section titled “The chain, and what the browser says”openssl s_client is a TLS client: it connects and tells you what it sees. On the server:
14. The chain
openssl s_client -connect 192-168-5-15.sslip.io:443 -servername 192-168-5-15.sslip.io -CAfile ~/authority/ca.crt < /dev/nullWhat you will see:
Connecting to 192.168.5.15CONNECTED(00000003)depth=1 CN=Ana's shop authorityverify return:1depth=0 CN=192-168-5-15.sslip.ioverify return:1---Certificate chain0 s:CN=192-168-5-15.sslip.io i:CN=Ana's shop authority a:PKEY: EC, (prime256v1); sigalg: ecdsa-with-SHA256 v:NotBefore: Oct 18 00:24:13 2026 GMT; NotAfter: Jan 16 00:24:13 2027 GMT---…Verification: OK…Verify return code: 0 (ok)…-servername: the name that goes in the SNI, so nginx picks the certificate (Phase 0).< /dev/nullcloses the connection when it’s done.depth=1anddepth=0: the check, from the root (your authority) to the shop.Certificate chain: what nginx sends, a single certificate.s:is whose it is;i:, who signed it. With Let’s Encrypt you’d see two: yours and the intermediate’s, thefullchain.pem.
15. Without -CAfile
openssl s_client -connect 192-168-5-15.sslip.io:443 -servername 192-168-5-15.sslip.io < /dev/null 2>&1 | grep -E "depth|verify|Verify return code"What you will see:
depth=0 CN=192-168-5-15.sslip.ioverify error:num=20:unable to get local issuer certificate…Verify return code: 21 (unable to verify the first certificate)curl’s error 20 from step 11.
Open https://192-168-5-15.sslip.io/health in your computer’s browser. We did it with Chromium 153, the base of Chrome and Edge, in English:
Your connection is not private
Attackers might be trying to steal your information from 192-168-5-15.sslip.io (for example, passwords, messages, or credit cards). Learn more about this warning
NET::ERR_CERT_AUTHORITY_INVALIDBack to safetyAdvancedERR_CERT_AUTHORITY_INVALID: the authority isn’t on its list. It’s the first of the three checks from Phase 0; the name and the dates are fine. When you press “Advanced”:
This server could not prove that it is 192-168-5-15.sslip.io; its security certificate is not trusted by your computer's operating system. This may be caused by a misconfiguration or an attacker intercepting your connection.
Proceed to 192-168-5-15.sslip.io (unsafe)Firefox and Safari word it differently. If you go in with “Proceed,” the connection is encrypted, but the browser ignores the HSTS header: it doesn’t come from a valid certificate.
Trusting your authority (optional)
Section titled “Trusting your authority (optional)”To get the padlock, add ca.crt to your computer’s authorities. On macOS, double-clicking it adds it to Keychain Access: open it there and, under “Trust,” choose “Always Trust.” On Windows, double-click it, “Install Certificate” and the “Trusted Root Certification Authorities” store. Firefox can use its own list, in its certificate settings.
Think it over first: your computer will trust any certificate ca.key signs, for any name, your-bank.example included. Whoever has that key could pass themselves off as any website to you. Before you trust it, delete ca.key on the server: it has already signed the certificate, and for another one you’ll make another authority.
Delete the authority's key
rm ~/authority/ca.keyls -l ~/authorityWhat you will see:
total 16-rw-rw-r-- 1 ubuntu ubuntu 607 Oct 18 02:24 ca.crt-rw-rw-r-- 1 ubuntu ubuntu 660 Oct 18 02:24 shop.crt-rw-rw-r-- 1 ubuntu ubuntu 473 Oct 18 02:24 shop.csr-rw------- 1 ubuntu ubuntu 241 Oct 18 02:24 shop.keyWithout ca.key, nobody signs anything else with your authority. When you finish the phase, remove your computer’s trust in it, where you added it, and delete ca.crt if you like. If Chrome has already seen the HSTS header, delete it at chrome://net-internals/#hsts, with “Delete domain security policies” and your name.
With a domain: Let’s Encrypt
Section titled “With a domain: Let’s Encrypt”On a VPS with a domain, steps 3 to 7 and the browser’s warning go away: Let’s Encrypt does them. Before you start, check on your server that 80 lets the challenge through. It works the same on the VM:
16. A test challenge
sudo mkdir -p /var/www/html/.well-known/acme-challengeecho "challenge-test" | sudo tee /var/www/html/.well-known/acme-challenge/testWhat you will see:
challenge-testA file where Let’s Encrypt would look for it.
17. What Let's Encrypt would see
curl -i http://192-168-5-15.sslip.io/.well-known/acme-challenge/testcurl.exe -i http://192-168-5-15.sslip.io/.well-known/acme-challenge/testWhat you will see:
HTTP/1.1 200 OKServer: nginx/1.28.3 (Ubuntu)…challenge-testFrom your computer: 200, not 301. On the server, delete it with sudo rm -r /var/www/html/.well-known.
And the steps, on your VPS:
-
Buy the domain from a registrar and create the A record with your server’s IP, and the AAAA one if it has IPv6, with TTL 300. Check it from your computer with
dig +short shop.example. -
Open 80 and 443 in
ufw(lesson 2) and in the provider’s firewall. -
Put your domain in the two
server_namelines and inALLOWED_ORIGINS, as in steps 8 to 10. -
Install certbot. In October 2026, its instructions recommend the snap package. If you have the
aptone, remove it first (sudo apt remove certbot).
18. certbot, as a snap
sudo snap install --classic certbotsudo ln -s /snap/bin/certbot /usr/local/bin/certbotcertbot --versionWhat you will see:
…certbot 5.8.0 from Certbot Project (certbot-eff✓) installedcertbot 5.8.0ln -s creates a link so the certbot command can be found. Captured on the VM: your version may be newer.
-
Ask for the certificate: first, as a test,
sudo certbot certonly --nginx --dry-run -d shop.example: if it fails, it doesn’t use up Let’s Encrypt’s limits. Then,sudo certbot --nginx -d shop.example. The first time it asks you for an email and to accept the terms; it does the challenge, changes the twossl_certificatelines of your site and reloads nginx. If you copyshop.confagain, change those two lines yourself: they’re commented out in the file. -
Test the renewal:
sudo certbot renew --dry-runsimulates it against the test servers. -
Open
https://shop.examplein the browser: now, at last, the padlock.
The renewal is launched by a systemd timer the snap installs:
19. certbot's timer
systemctl cat snap.certbot.renew.timerWhat you will see:
…[Timer]Unit=snap.certbot.renew.serviceOnCalendar=*-*-* 01:12OnCalendar=*-*-* 20:03…Twice a day. certbot looks at each certificate and only renews the ones close to expiring: the rest of the days, it does nothing.
With your domain and HTTPS you can now offer “Sign in with Google”: Google requires an https:// callback URL on a domain of yours, not an IP or sslip.io. The steps are in Phase 6: you register https://shop.example/v2/session/provider/callback and remove the # from the four OIDC_* lines of .env.
You have already seen it
Section titled “You have already seen it”- This website’s padlock. Its certificate is signed by Google Trust Services, valid for 90 days (from October 9, 2026 to January 7, 2027), and covers
backenddesdecero.comand*.backenddesdecero.com. Cloudflare, which serves the site, requests and renews it without us doing anything.
Common mistakes
Section titled “Common mistakes”- Closing 80 “because everything goes over HTTPS now.” The renewal fails silently and the certificate expires weeks later.
- An AAAA that points somewhere else. If it exists, Let’s Encrypt tries IPv6 first (its documentation). If your server doesn’t have IPv6, don’t create the record.
- Asking for the certificate before the DNS points to the server. Let’s Encrypt sees the old IP, and retrying many times runs into its limits.
- Going in by the IP with a certificate that only has the name. curl says
no alternative certificate subject name matches target ipv4 address: the URL’s name has to be insubjectAltName. - Copying or sharing
ca.key. With it, anyone can sign any name your computer will accept. - Trying HTTPS with your domain and going back to http. Whoever saw HSTS won’t be able to get in over http for 180 days, on any subdomain either (
includeSubDomains). Test with a subdomain, likeshop.yourdomain.com. - Removing the authority after the browser saw HSTS. For 180 days it won’t let you “Proceed” past the warning, unless you delete the rule.
Summary
Section titled “Summary”- A domain is bought by the year; its A and AAAA records point to your server, and the TTL says how long a change takes to show.
- Let’s Encrypt checks that the domain is yours by asking for a file over port 80 from the internet. certbot does it all and renews on its own.
- No public IP, no Let’s Encrypt. With sslip.io and your own authority you have real HTTPS on your computer, and a warning on any other.
- With a valid certificate, the redirect to https and the HSTS header start protecting.
Did you get it?
Section titled “Did you get it?”To review:
Further reading
Section titled “Further reading”- How It Works, from Let’s Encrypt: ACME and the domain check, step by step.
- Challenge Types: HTTP-01, DNS-01 (for
*.shop.examplecertificates) and when to use each one. - Certbot instructions: nginx with the snap, the exact command for your system.
- RFC 8555: the ACME protocol.
- sslip.io: how its names work.
- Strict-Transport-Security, on MDN.