Chapter 7: Static Website Hosting (3 OSes × 2 Web Servers)
7.13 Adding HTTPS and verifying the certificate
Quick answer: the short, self-contained version of this lesson is the guide How to Install a Free SSL Certificate on EC2 (Certbot).
Friends, this certificate lab uses a domain that you control and points it at the server before running Certbot. Let's Encrypt also issues short-lived certificates for validated public IP addresses through a different workflow. A domain is the simpler option for this lab. If you don't have one yet, read through the steps and come back after Chapter 9. Let’s Encrypt on IP address certificates
मित्रांनो, या public lab साठी तुमच्या नियंत्रणातले DNS नाव वापरू. Let’s Encrypt कडून पात्र public IP साठी short-lived certificate मिळू शकते. त्याची प्रक्रिया वेगळी आहे. Domain नसेल तर खालील local TLS lab करा.
दोस्तों, इस public lab में अपने नियंत्रण वाला DNS नाम इस्तेमाल करेंगे। Let’s Encrypt से पात्र public IP के लिए short-lived certificate मिल सकता है। उसकी प्रक्रिया अलग है। Domain नहीं है तो नीचे वाला local TLS lab करो।
Browsers mark plain HTTP as "Not secure". Free TLS certificates are available from Let's Encrypt via certbot. You need a domain name whose A record points to your Elastic IP (see Chapter 9) and port 443 open.
Find the supported Certbot installation for your assigned distribution and web server. The expanded lab below shows an explicit webroot validation and separates issuance, installation, verification and renewal.
cat /etc/os-release
certbot --version
Amazon Linux 2023: if the certbot package is not found
Install certbot in a Python virtual environment instead: sudo python3 -m venv /opt/certbot && sudo /opt/certbot/bin/pip install certbot certbot-nginx && sudo ln -s /opt/certbot/bin/certbot /usr/bin/certbot (use certbot-apache for Apache).
In this lab the web-server installer plugin edits the virtual host and installs the certificate. Confirm how your package schedules renewal, and test it with sudo certbot renew --dry-run. Verify the live hostname in the browser after the install. The bare-IP workflow uses different settings and requires a supported client and reliable short-interval renewal.
Ravindra Bagale's Tip
Before HTTP-01, check DNS A and AAAA answers and confirm the exact challenge URL is reachable from the public validation path on port 80. DNS-01 uses its DNS record instead. Test the site’s HTTPS listener separately after issuance and installation.
Ravindra Bagale's Tip – मराठी
HTTP-01 आधी DNS मधले A आणि AAAA records तपासा. योग्य challenge URL बाहेरून port 80 वर उघडतो का ते पहा. DNS-01 साठी DNS record लागतो. Certificate install झाल्यावर site चा HTTPS listener वेगळा तपासा.
Ravindra Bagale's Tip – हिंदी
HTTP-01 से पहले DNS के A और AAAA records जाँचो। सही challenge URL बाहर से port 80 पर खुलता है या नहीं देखो। DNS-01 DNS record जाँचता है। Certificate लगाने के बाद site का HTTPS listener अलग से जाँचो।
Lab
Chala, approved public name asel tar khalcha issuance lab kara ani tya certificate sathi renewal dry run tapaasa. Domain nasel tar local TLS lab kara. Barobar nav ani trusted authority ne request chalte ka, ani chukiche nav kiva trust nasel tar request reject hote ka te paha.
Give a static site a verified HTTPS identity
A training group has published the opening hours of a neighbourhood workshop. The page is public, yet the group wants customers to know that the address they opened belongs to the expected service and that the market hours were not exchanged over an unprotected connection. HTTPS creates a protected HTTP conversation using TLS, or Transport Layer Security. It helps protect requests and replies against observation and tampering in transit and gives the client a way to verify the server identity for the URL it used.
Changing http:// to https:// in a browser asks for a different type of connection. The server needs a suitable listener and its certificate configuration. The client needs a certificate whose identity covers the name or address it is verifying and a trust path to a recognized authority. After that exchange, the chosen virtual host still needs to serve the right site. This lesson separates those requirements so a wrong certificate, route and HTML file can be investigated with different evidence.
The public practice procedure here uses a DNS name that you control and an appropriate ACME validation method. ACME is a protocol for automating certificate requests and proving control of the requested identity. The local lab creates a temporary private training authority and works without a purchased domain or any external service. Use only a synthetic sample in these exercises. The local certificates and keys are confidential training files within the scratch environment and are removed when it finishes.
Follow a request through DNS, TLS and HTTP
Consider https://workshop.example.test/hours.html. The example name is reserved for testing. An ordinary client obtains an address for this name through its resolver and connects to the configured port, usually 443 for HTTPS. The TCP connection must succeed before the ordinary HTTP-over-TLS exchange can proceed. The client sends TLS handshake information and generally includes the requested DNS hostname using Server Name Indication, or SNI. A server with several TLS sites on one socket can use that name to select a suitable certificate.
The host sends a certificate and any intermediates needed for the client to build a path to its trust anchors. A trust anchor is an authority the client already accepts under its policy. The client checks time, identity and trust, among other protocol requirements. The certificate normally names the valid DNS identities in its subject alternative name extension, often abbreviated SAN. A certificate issued for a DNS name identifies that name. For a client connecting through a literal IP URL, the matching identity is an IP address entry covering that exact address.
The private key corresponding to the leaf certificate belongs only to the server or its trusted TLS infrastructure. The server uses it in the handshake to demonstrate control of the credential. The client's ability to inspect a public certificate does not let it impersonate that server, because viewing the certificate does not reveal the key. Store key files under the owner-approved access rules and outside every public web folder. Do not paste them into a configuration troubleshooting report. Public certificate fields such as the issuer, validity and names are the useful comparison values.
| Stage | Decision | Example evidence |
|---|---|---|
| Name resolution | Which address should the client reach? | Check the DNS A and AAAA answers or an explicit test override. |
| Network connection | Is the intended HTTPS listener reachable? | Compare the client path, allowed rules and a listening socket. |
| TLS handshake | Does the certificate chain validate for the URL identity? | A verified client accepts the handshake and can report its certificate details. |
| Protected HTTP request | Which vhost and path deliver the content? | The request returns the planned status, type, marker and site log. |
A TLS certificate for a name usually authenticates the service's control of that identity under the authority's policy. The certificate does not tell you whether the public page's claims are correct or whether the server is free of software bugs. Pair identity verification with a content acceptance request. For example, a valid certificate and a site body naming another workshop show that TLS succeeded while host or resource selection still needs attention.
Choose a certificate identity that matches the deployment
For a normal public brochure, a stable DNS name lets a maintainer change the endpoint without asking visitors to remember a new address. The people maintaining DNS and certificates should agree on the actual names to cover. Include the alternate hostnames users should reach, such as the approved www name, only when the site owns and tests them. A redirect from an old HTTPS hostname still begins with a handshake for the old hostname. If clients must follow that redirect, configure the old name's certificate and listener deliberately as part of the transition.
HTTPS can also work for an IP address. The certificate needs an IP SAN for the exact address and clients must trust the issuer. Let's Encrypt makes publicly trusted short-lived certificates available for eligible IP addresses that it can validate. Those are issued through its short-lived profile. A March 2026 Certbot workflow describes --ip-address and compatible versions, including Certbot 5.4 or later for its shown webroot procedure. Consult the current issuer and client instructions when choosing that path. At launch Let’s Encrypt described its IP profile certificates as valid for 160 hours. The shorter lifetime makes automatic renewal and successful deployment especially important.
A public issuer applies its own rules for public identities and cannot use your private training names as if they were public domains. For a private site you can use an organizational certificate authority if the intended clients are configured to trust it. For the local exercise the client trusts only an explicit temporary public authority certificate supplied for that test. We will not add a certificate to the workstation's system trust store. Choosing the trust audience is part of the deployment plan. A certificate shown as acceptable on a lab machine might be rejected by an outside visitor whose trust policy differs.
An Elastic IP is an AWS option for a directly associated public IPv4 address. It does not issue a certificate or repair an incorrect DNS record. The HTTPS endpoint might instead be operated by a load balancer or another trusted front door. Decide where TLS will terminate, meaning where the protected connection is authenticated and decrypted. Configure its certificate and inspect the next hop separately. A certificate on an origin can be useful on that leg while the external client still receives the front door's own certificate.
Pick a validation method before changing network rules
A certificate authority needs evidence that the requester controls every public identity in the requested certificate. An ACME client such as Certbot communicates with the authority and arranges a challenge. The authority checks a defined value at the web or DNS endpoint. This proves control at issuance or renewal under that method. The publicly trusted certificate is installed after successful issuance, and ordinary site visitors connect to the resulting HTTPS listener. Challenge traffic and normal visitor traffic have related but distinct requirements.
| Method | The authority checks | Required access for validation |
|---|---|---|
| HTTP-01 | A token at an expected /.well-known/acme-challenge/ URL. | The public challenge endpoint is reached using HTTP port 80 initially. |
| DNS-01 | A TXT record under the designated ACME challenge name. | The authority must see the public DNS answer. It does not fetch this token from the web server. |
| TLS-ALPN-01 | A purpose-built challenge handshake at a compatible endpoint. | The public validation path uses TLS port 443 and needs supported software. |
HTTP-01 is commonly used for an ordinary public DNS name. The server must answer from the intended public port 80, and the challenge token must emerge from the vhost and folder the authority reaches. The issuer may support certain redirects, but keeping the dedicated challenge path predictable helps initial setup and renewal. Opening only port 443 does not provide the initial HTTP-01 connection. Conversely, success at port 80 does not prove that visitors can reach the site's eventual TLS endpoint on 443.
DNS-01 places the challenge in public DNS and is the standard path for Let's Encrypt wildcard names. It can work even when web access to the origin remains private. For automated renewal design a narrowly scoped credential or approved delegated setup for writing that challenge record. Store provider credentials separately from site files and use the authority or provider documentation to ensure the account can change only the intended zone or record scope. A manual change may satisfy a one-time check and still leave expiry risk if no sustainable renewal method exists.
Where a reverse proxy, CDN or dual-stack service sits in front, identify what each public DNS answer actually reaches. A correct A record gives evidence about IPv4 only. A published AAAA record can send a validation server or user to a different IPv6 path. If you configure multiple working ingress nodes, arrange for the same token to be served by any eligible challenge endpoint. Check upstream routing and publication as a whole. Avoid using a production live name as a practice scratchpad if the class controls only one isolated origin.
Inspect the public route and challenge file on the assigned site
Use an assigned domain and webroot for this optional exercise. Check the current Nginx or Apache host mapping and note your starting service state. Confirm the DNS name from a permitted client and compare its address answers with the intended endpoint. Use the approved static HTTP server before changing certificate settings. This first observation can show whether the named sites and files work over that path, independent of the later TLS choice. A browser that forces HTTPS may not be appropriate for testing the initial challenge URL.
SITE='REPLACE_WITH_APPROVED_PUBLIC_DNS_NAME'
dig +short A "$SITE"
dig +short AAAA "$SITE"
curl --noproxy '*' --silent --show-error --max-time 8 --include \
"http://$SITE/"
Look for the address or front door expected in the exercise. Use read-only AWS and host controls to inspect the routing and necessary connections before modifying a rule. When testing the HTTP webroot route on your own site, create a new synthetic test file under .well-known/acme-challenge only if the trainer approved that exact directory and filename. Request it through the ordinary approved public path using its exact HTTP URL. Check that the returned body equals the test value. Remove this deliberate test file afterward. Certbot later writes its own temporary token and should control its own challenge files.
A generic homepage under the challenge URL means the request reached a server, but a fallback or rewrite provided other content. A 403 might come from a rule hiding all dot-prefixed paths, or from ordinary filesystem access, host policy or an incorrect vhost. A 404 suggests testing the file's exact mapped path. Use site records and the remote response as clues. A syntax test for Apache or Nginx can be green throughout these faults because the active rule set is valid but does not serve the chosen challenge correctly.
When changing an existing vhost or public listener, make a scoped backup and preserve unrelated sites. Verify which file or link the service loads. A certificate installer can edit server configuration; this lesson demonstrates the webroot certonly path so the learner can review the site configuration separately. Verify the client's supported installation route for the exact distribution and release using its official instructions. Apt, DNF, repository availability and plugin versions vary across Ubuntu, AL2023 and CentOS Stream; using an approved current package avoids mixing an old client with flags it does not support.
Lab one. Request and inspect the public name's certificate
For this optional lab you need permission to administer a public test name and vhost, the approved webroot that serves its HTTP-01 token, and a Certbot installation appropriate to the distribution. Confirm how the renewal scheduler will run before issuing a certificate that a public service will rely on. Work within your site scope. This exercise uses the webroot authenticator and certonly, which obtains the certificate without asking Certbot to install it into Nginx or Apache. Read any prompts and ensure the current account and site are the intended ones.
SITE='REPLACE_WITH_APPROVED_PUBLIC_DNS_NAME'
WEBROOT='REPLACE_WITH_APPROVED_HTTP_CHALLENGE_WEBROOT'
certbot --version
sudo certbot certonly --dry-run --webroot -w "$WEBROOT" -d "$SITE"
# After the dry run succeeds and production issuance is approved:
sudo certbot certonly --webroot -w "$WEBROOT" -d "$SITE"
sudo certbot certificates
A dry run uses Certbot's testing facilities for the chosen challenge and should not save a usable production certificate. The active HTTP endpoint still needs to be reachable for the test. Read the outcome and resolve any failed identifier before making a production request. The issued certificate has a name in Certbot's local inventory. That lineage name and its assigned paths can differ from what you guessed from the hostname, especially when similar certificates already exist. Record the reported certificate and key paths. Keep the key readable only by the trusted service component or owner.
If you practice issuance outside the authorized public exercise, use the local trust lab instead. For a public rollout run the issuance for the names the owner approved. Do not repeatedly retry against the production CA while DNS or path checks are still failing, since issuers have rate limits. Read which identifier failed, test the corresponding route and make a bounded correction. A DNS-01 setup would use a supported DNS plugin or automation mechanism rather than the webroot switch. An IP certificate uses its separate client flags and the relevant challenge policy, not a made-up DNS name.
Install the certificate on the listener that users actually reach
Choose the actual point that accepts TLS for the site's normal traffic. That could be Nginx, Apache or a managed front door. If Apache or Nginx terminates TLS for the exercise, add the certificate and private-key paths to the appropriate TLS virtual host. Configure the site name, protected listener, and expected document root together. The full chain file usually contains the leaf certificate followed by the needed intermediates. Sending only the leaf can leave some clients unable to construct trust; install and verify the chain according to the server's reference.
# Nginx fragment inside the approved TLS server block.
listen 443 ssl;
server_name workshop.example.test;
ssl_certificate /etc/letsencrypt/live/APPROVED_LINEAGE/fullchain.pem;
ssl_certificate_key /etc/letsencrypt/live/APPROVED_LINEAGE/privkey.pem;
root /var/www/workshop-release;
# Apache fragment inside the approved TLS virtual host.
ServerName workshop.example.test
DocumentRoot "/var/www/workshop-release"
SSLEngine on
SSLCertificateFile "/etc/letsencrypt/live/APPROVED_LINEAGE/fullchain.pem"
SSLCertificateKeyFile "/etc/letsencrypt/live/APPROVED_LINEAGE/privkey.pem"
These are excerpts. Replace the reserved practice name and training paths with the confirmed public DNS name and actual files from the issued certificate inventory. The Apache fragment needs a properly configured listening socket, the appropriate mod_ssl setup, and its enclosing vhost, directory and logging rules. On some packages the regular TLS listener is already configured, so inspect the loaded files rather than duplicating a Listen line. For Nginx verify the build and supported options for the TLS socket. Keep unrelated TLS server blocks intact. A managed endpoint uses its own certificate attachment process and host rule selection.
Review the specific configuration backup and syntax before activation. Use nginx -t for Nginx or the approved Apache configuration test on the guest. Reload through the owned service or apply the managed endpoint change under the site's plan. Read any errors immediately. A protected private-key path may be unreadable by a different service identity, a leaf and key may not match, or another block could bind the port differently. Check the exact reason before changing file permissions. Avoid making private keys broadly readable merely to remove an activation error.
Once the TLS listener and file path are verified, plan the HTTP redirect if required. Start by testing HTTPS directly with the intended URL. Add only the site's approved redirect and preserve any required ACME challenge path. Verify the status and target before following it, and then verify the final response. Choose a status according to the site's navigation and deployment policy. Durable redirects can be cached. Long-lived Strict Transport Security settings, if planned separately, can make clients require HTTPS for future visits and should be applied only after the service and any affected hostnames are ready.
Lab two. Verify a temporary certificate and reject the wrong name on loopback
You need Python 3 and an OpenSSL-compatible command with support for creating a request and signing it with an explicitly configured certificate extension. Use the approved openssl already available locally. This script creates a tiny private authority and a leaf certificate valid for the reserved practice name. It runs a temporary TLS server bound to an ephemeral loopback port. One request is accepted using that authority in a dedicated Python trust context. Another request with a mismatched name fails, and a client without the temporary authority fails trust validation. No public CA, site, DNS or system trust setting participates.
python3 - <<'PY'
from http.client import HTTPResponse
from http.server import BaseHTTPRequestHandler, ThreadingHTTPServer
from pathlib import Path
from tempfile import TemporaryDirectory
from threading import Thread
import os
import shutil
import socket
import ssl
import subprocess
openssl = shutil.which("openssl")
if not openssl:
raise SystemExit("Use an approved local openssl executable.")
name = "workshop.example.test"
class Hours(BaseHTTPRequestHandler):
def do_GET(self):
text = (b"Workshop hours are verified in this lab\n"
if self.path == "/hours.html" else b"Unknown workshop path\n")
self.send_response(200 if self.path == "/hours.html" else 404)
self.send_header("Content-Type", "text/plain; charset=utf-8")
self.send_header("Content-Length", str(len(text)))
self.end_headers()
self.wfile.write(text)
def log_message(self, format, *args):
pass
with TemporaryDirectory(prefix="workshop-tls-") as area:
base = Path(area)
(base / "ca.conf").write_text("""
[req]
prompt=no
distinguished_name=ca_name
x509_extensions=ca_ext
[ca_name]
CN=Workshop fixture temporary authority
[ca_ext]
basicConstraints=critical,CA:TRUE,pathlen:0
keyUsage=critical,keyCertSign,cRLSign
subjectKeyIdentifier=hash
""")
(base / "leaf.conf").write_text(f"""
[req]
prompt=no
distinguished_name=server_name
[server_name]
CN={name}
[server_ext]
basicConstraints=critical,CA:FALSE
keyUsage=critical,digitalSignature,keyEncipherment
extendedKeyUsage=serverAuth
subjectAltName=DNS:{name}
subjectKeyIdentifier=hash
authorityKeyIdentifier=keyid,issuer
""")
def create(*args):
result = subprocess.run([openssl, *args], cwd=base, text=True,
capture_output=True)
if result.returncode:
raise RuntimeError(result.stderr)
create("req", "-x509", "-newkey", "rsa:2048", "-nodes", "-days", "2",
"-config", "ca.conf", "-keyout", "ca.key", "-out", "ca.pem")
create("req", "-newkey", "rsa:2048", "-nodes", "-config", "leaf.conf",
"-keyout", "leaf.key", "-out", "leaf.csr")
for secret in ("ca.key", "leaf.key"):
os.chmod(base / secret, 0o600)
create("x509", "-req", "-in", "leaf.csr", "-CA", "ca.pem", "-CAkey", "ca.key",
"-CAcreateserial", "-days", "1", "-sha256", "-extfile", "leaf.conf",
"-extensions", "server_ext", "-out", "leaf.pem")
context = ssl.SSLContext(ssl.PROTOCOL_TLS_SERVER)
context.minimum_version = ssl.TLSVersion.TLSv1_2
context.load_cert_chain(base / "leaf.pem", base / "leaf.key")
with ThreadingHTTPServer(("127.0.0.1", 0), Hours) as web:
port = web.server_port
web.socket = context.wrap_socket(web.socket, server_side=True)
server = Thread(target=web.serve_forever, daemon=True)
server.start()
def request(tls_config, host):
with socket.create_connection(("127.0.0.1", port), timeout=4) as net:
with tls_config.wrap_socket(net, server_hostname=host) as tls:
tls.sendall(f"GET /hours.html HTTP/1.1\r\nHost: {host}\r\n"
"Connection: close\r\n\r\n".encode("ascii"))
response = HTTPResponse(tls)
try:
response.begin()
return response.status, response.read().decode()
finally:
response.close()
try:
known_ca = ssl.create_default_context(cafile=str(base / "ca.pem"))
status, page = request(known_ca, name)
assert status == 200 and "Workshop hours" in page
print(f"trusted authority and matching name: {status} {page.strip()}")
for first, host, description in (
(known_ca, "wrong.example.test", "different DNS name"),
(known_ca, "127.0.0.1", "IP absent from the certificate"),
(ssl.create_default_context(), name, "temporary authority untrusted"),
):
try:
request(first, host)
except ssl.SSLCertVerificationError as failure:
print(f"expected rejection: {description}: {failure.verify_message}")
else:
raise AssertionError(f"Verification unexpectedly passed: {description}")
finally:
web.shutdown()
server.join(timeout=5)
PY
The first case should return 200 and the expected workshop hours. In the next three cases the TCP endpoint is the same. The source of the rejection changes: the URL identity is a different name, the requested identity is an IP absent from the certificate, or the leaf cannot be verified under the client's ordinary trust. These errors occur while completing TLS, so no accepted HTTP response is available for those cases. The certificate was intentionally generated with only one DNS SAN. Changing the client address without changing the verified DNS identity behaves differently from asking it to verify a new identity.
This fixture is a brief TLS experiment rather than a production authority setup. The key is stored in a private temporary directory with restricted file permissions. The program trusts the local authority only within one client context and leaves the workstation trust store alone. At the end it stops the server and removes the temporary tree, including both keys. If one of the local library operations fails, record the exact command and error. A compatible Python TLS implementation and an up-to-date OpenSSL-style command are needed. There is no reason to disable peer verification to make the exercise pass.
Verify the normal public response before interpreting the lock indicator
Use the intended public hostname in the final HTTPS URL. First request the named page without a test override to exercise normal name resolution and the intended front door. Observe the certificate and response using an ordinary verifying client. A successful result should show the expected HTTP status and public release marker. If you also need to check an isolated origin, preserve the HTTPS URL and override only the network address with curl --resolve. Do not replace the URL with a bare IP simply because the connection uses that IP.
SITE='REPLACE_WITH_APPROVED_PUBLIC_DNS_NAME'
curl --noproxy '*' --silent --show-error --max-time 8 --include \
"https://$SITE/hours.html"
ORIGIN='REPLACE_WITH_APPROVED_IPV4_ORIGIN'
curl --noproxy '*' --resolve "$SITE:443:$ORIGIN" \
--silent --show-error --max-time 8 --include "https://$SITE/hours.html"
An origin behind a separate TLS endpoint may use a different certificate or private host policy by design. The direct probe is appropriate only when the origin is intended to terminate TLS for the exact name and the operator has an approved path to it. When the managed endpoint terminates TLS, separately test that endpoint's certificate and the configured backend path with their respective expected identities. A failed direct test does not prove a public defect if the origin was never supposed to accept that protocol or name. Record which connection and host each result covers.
For deeper inspection of the leaf returned on a normal TLS connection, use a client that reports whether server verification passed. A supported OpenSSL client can supply the requested SNI name and an explicit verification target. Select the host system's proper trust settings so the check corresponds to the relevant client. A command that merely lists the received certificates can be useful for examination, while the presence of a printed certificate is insufficient to prove a trusted chain or correct identity. Pair any display command with a known verifying HTTP client and the expected name.
openssl s_client -connect "$SITE:443" -servername "$SITE" \
-verify_hostname "$SITE" -verify_return_error </dev/null
Read the captured issuer, dates and name data, then compare the installed leaf with the one actually presented if they differ. The private key is never needed to make this diagnosis. On a managed device a local proxy can insert its own trust chain according to that environment's policy. To understand a discrepancy between visitors, check the expected delivery path and client trust on each allowed device. A browser security icon can summarize an accepted connection. The actual URL, certificate identity and content provide the reproducible evidence the site owner needs.
Verify renewal and confirm what the live process will serve
A certificate expires at a specific time. Before that time the owner needs an automated or deliberately managed renewal process that can satisfy the validation method again. A DNS change or a stricter network rule after the initial issue can break HTTP-01. Moving the public root can leave the saved webroot path wrong. DNS-01 can fail after a credentials rotation or delegated zone change. A working first certificate is a baseline, not evidence that later requests to the authority will still reach the challenge data.
sudo certbot certificates
sudo certbot renew --cert-name 'REPLACE_WITH_APPROVED_LINEAGE' --dry-run
systemctl list-timers --all
Check the exact certificate name and which authenticator maintains it. The scoped dry run exercises a renewal attempt via the configured method, normally against a staging service. It does not by itself deploy a new production certificate. Review the scheduled task or timer supplied by the package, or the documented existing scheduler for the managed platform. Some installations use a timer and others use a cron job or external automation. Avoid adding a second renewal job without knowing what already exists. A shared scheduler may be responsible for many unrelated certificates.
The scheduler's successful exit is also separate from the identity servers are currently presenting. Nginx or Apache can continue using an already loaded certificate after files on disk have been updated. Arrange an approved deployment action after successful renewal, such as validation and a controlled reload or a managed attachment update. A deploy hook runs at the right point when configured correctly. Check that the hooks and any service reload apply to the intended site infrastructure. A dry run normally has different hook behaviour from production, so read the Certbot documentation and test the planned handoff separately.
Monitor the certificate actually presented by the public URL and the readiness of its renewal process. The relevant date belongs to that served leaf, not merely a timestamp in the local certificate directory. Keep an alert early enough to correct a challenge path or deployment problem. Hosting an IP-only short-lived certificate makes an unmonitored delay more consequential. In a multi-endpoint site check each accepted ingress or the provider's configured distribution. One healthy node does not verify that all independent endpoints adopted the current chain.
Locate the stage of failure with a narrow comparison
| Observation | Evidence to obtain | Decision you can isolate |
|---|---|---|
| Domain does not resolve to the approved target. | Compare A and AAAA answers with the actual site ingress. | Whether the client selects the correct endpoint. |
| HTTP-01 token cannot be fetched. | Request the exact token path and inspect the port 80 public route and vhost rules. | Whether the challenge reaches the intended webroot. |
| TCP connects but the client reports the wrong certificate name. | Compare the URL identity and expected SNI with the SANs of the served leaf. | Whether the endpoint chose a certificate covering that identity. |
| Names match yet a client cannot verify the issuer. | Inspect the served chain and that client's trust configuration. | Whether the client can build a trusted path. |
| TLS verifies and the server returns a welcome page. | Inspect the selected HTTPS vhost, root and per-site logs. | Whether HTTP selected the intended site's release after the handshake. |
| The dry-run renewal worked, but the public site still offers an older leaf. | Compare the issuance inventory, deployed file or managed attachment, and presented chain. | Whether a real certificate was issued and adopted by the endpoint. |
Pay special attention to a mismatch that occurs on only one hostname. A certificate with one DNS SAN covers that name, while another configured alias might need its own SAN or corresponding certificate. A wildcard has specific matching patterns and should not be assumed to cover every number of labels. Verify each official name literally using the client. On a shared port one name can complete TLS with the correct credential and another can select a default credential. Look at the server blocks for both names and compare what is actually presented.
When the same HTTPS page looks incomplete but the handshake worked, check how its other resources are fetched. An HTML document can refer to HTTP scripts, styles or other assets. A browser may block or treat such mixed content differently according to its policy. Start with the browser's resource request list and update deliberately owned references to the appropriate HTTPS endpoints. An internal site-relative URL can inherit the scheme of the document when it refers to that same host. Keep certificate, HTTP and browser-resource evidence distinct so you repair the exact dependency that failed.
Review system time when a cert appears expired or not yet valid earlier than expected. A client uses its time to interpret the certificate validity interval. Check the reported UTC times and the current clock on the device doing the validation. An old certificate still shown by the server can come from a missed reload, a route to an earlier origin, or a separate TLS proxy. Clarify that candidate cause with one comparison of dates and issuer information from each intended endpoint. Opening more ports cannot change the validity of a certificate already received.
Trace a challenge failure after moving the document root
Suppose the workshop team changes the public root from a spring release to an autumn release. The ordinary HTTPS page passes, because the current listener and existing certificate still work. Later the renewal attempt fails. Certbot writes a test token in the previously configured webroot. The HTTP vhost now looks for that path under the new release. From the authority's viewpoint the target URL returns the shop's custom 404. This sequence explains why testing only the current certificate and homepage can miss a future renewal problem.
Compare the public challenge URL with the actual path used by the recorded certificate lineage. Check how the approved service defines that path and whether it is independent of the site's changing release root. If it should be stable, retain the explicit challenge mapping when you rotate the rest of the site content. If the authenticator's saved webroot must change, use the installation's supported Certbot reconfiguration procedure and run a scoped renewal dry run for the approved certificate. Keep the previous valid service credentials until the owner confirms the replacement can be installed and verified.
Take the same evidence for each requested name. One name may go through an earlier CDN while another goes directly to Nginx. From the validation client's point of view those are separate routes. A valid response to one token URL demonstrates only that route and requested identity. Use the issuer's reported failing identifier, the public DNS answer and the exact status and token content to isolate the failing step. If a related HTTP redirect changed too, check the designated ACME path as well as the public redirect before declaring renewal ready.
Keep the service and challenge rollback within the exercise scope
For a managed exercise, retain the pre-change vhost and relevant original certificates and renewal ownership record. If a new route breaks HTTPS, use the site's approved rollback to restore the previous settings, verify configuration and check the real hostname again. A certificate shared by other names or sites has a different lifecycle from one created for this sample. Do not revoke or delete a shared credential as part of a single site's cleanup. Remove an unused practice certificate only after the owner confirms no service depends on it and updates or removes references according to Certbot's documented process.
If the test introduced temporary DNS or network settings, compare their state with the record from before the change. Preserve permanent requirements for a still-active site's renewal method and normal traffic. Remove only the authorized temporary items after the owner confirms they are no longer needed. The loopback lab needs no such actions. It stops its temporary process and removes its own keys and certificates. No browser, workspace trust store, public ingress or real DNS account has been modified by that fixture.
For an acceptance summary list which public names and address families were tested, who controls the active certificate, which challenge authenticates renewal, and the exact HTTPS path and response. If you used only the local lab, describe the verified matching-name case and the three expected rejections. It demonstrates trust and identity mechanics. A production acceptance check must also cover actual routes, certificate installation and renewal ownership for that service.
Record which TLS connection was verified
Keep the normal public URL and the direct origin request in separate lines of your report. They may see different certificates when a front door terminates TLS and opens another connection to an origin. Record the expected identity, presented leaf, verification result and returned content for each applicable hop. That gives another maintainer enough context to reproduce the right connection after a certificate rotation.
Interview questions with explained answers
Do you always need a purchased domain to use HTTPS?
HTTPS needs an appropriate TLS credential and client trust. A public DNS name is common for websites. A certificate may instead contain an eligible IP address identity, and a private service can use an authority its clients trust.
Why does changing a plain HTTP URL to an HTTPS URL produce a different failure?
The client first needs a TLS listener and a trusted certificate for the HTTPS identity. The HTTP resource is requested only after a successful protected session. Check that earlier stage when the browser reports a certificate or connection error.
Which port must be available for HTTP-01?
The challenge starts at public port 80 for the requested identity. The issuer has specific redirect rules. Port 443 is usually used for site HTTPS and is a separate requirement, while DNS-01 uses DNS validation.
How do you test a TLS vhost on a fixed destination without changing DNS?
Keep the desired hostname in the HTTPS URL and override its address for that host and port. A normal client still checks trust and the expected certificate identity, and the request then tests the selected vhost.
How can renewal work while a running site still serves the older certificate?
Issuance or update changes certificate material. The server or managed endpoint must adopt it. Check the deployment action and verify the live credential and content after the update.
Check your understanding
The same IP serves two TLS sites. What information lets it select the right credential before HTTP begins?
Show answer
A client commonly includes its expected DNS name using SNI in the TLS handshake. The listener can select a certificate for that name.
The HTTP-01 preflight fails with no reply on port 80. Is opening HTTPS alone sufficient?
Show answer
HTTP-01 starts on port 80. Fix the approved path to its token or use a compatible alternate method such as approved DNS validation.
A DNS certificate is valid and trusted for the workshop name. Why does the local fixture reject a URL identity of 127.0.0.1?
Show answer
The certificate only contains the DNS SAN. A literal IP identity requires a matching IP SAN.
A verified HTTPS request returns the packaged welcome body. Which stage would you check?
Show answer
The handshake succeeded for this connection. Check site name, HTTPS vhost and root to see why the expected content was missed.
Does a dry-run renewal alone establish that visitors received a replacement certificate?
Show answer
It checks the renewal path under the test procedure. Confirm actual production issuance, deployment and the certificate served to an ordinary verifying client.
Practise explaining the validation and serving paths
Draw the route of the HTTP-01 challenge and the route of an ordinary HTTPS page view. Identify the step where port, name and content are verified in each route.
Run the temporary authority fixture and record the successful verified request and three expected rejections. Identify which peer verification condition changed in each case.
Build a small acceptance and renewal plan for an approved name. List the normal URL, certificate identity, challenge owner, refresh check, and what the endpoint must do after a successful renewal.
Revision cards
- TLS
- Protects a client-server conversation and supports verifying the server identity. HTTPS applies it to HTTP.
- SAN
- The certificate extension that lists eligible DNS or IP identities. Match the type and value to the client's expected URL identity.
- Trust chain
- Link certificates from the server's leaf through intermediates to a locally trusted authority.
- ACME challenge
- Issuer-defined verification of identifier control. The selected method determines which route or data is needed for issuance.
- Full chain and private key
- The server presents the relevant certificates, while the corresponding private key stays under restricted control.
- Deployment after renewal
- Apply the renewed certificate to the expected listener, then inspect what the normal HTTPS client actually receives.
Official sources
- TLS 1.3 protocol
- TLS Server Name Indication
- Verifying service identity in TLS
- ACME protocol and validation
- HTTP Strict Transport Security
- Let's Encrypt challenge types
- Let's Encrypt IP and short-lived certificates
- Certbot client workflow for IP identities
- Certbot issuance, cleanup, hooks and renewal
- Certbot installation selector
- Nginx certificates and HTTPS server configuration
- Apache TLS configuration directives
- Curl TLS verification and address override
- OpenSSL client inspection commands
- Python TLS context and verification
- TLS certificates on Application Load Balancers
- Reserved testing names