Deploy a live website with HTTPS
Within an hour you'll get your own website online — with a valid HTTPS certificate from Let's Encrypt, your own subdomain, and real nginx. You'll edit HTML, check nginx config, and trigger certbot. At the end you can share the link — it stays live as long as the lab session runs (max. 60 minutes).
Your own page with a Let's Encrypt cert
Deploy a live website with HTTPS
In this module you put a real website online within an hour — with a valid HTTPS certificate. You edit HTML, check the nginx configuration, and fetch a certificate from Let's Encrypt via certbot.
Key terms
- Let's Encrypt: a free, automated certificate authority (CA) that issues real, browser-trusted certificates.
- certbot: the tool that fetches the Let's Encrypt certificate and installs it into nginx.
- HTTP-01 challenge: Let's Encrypt verifies over port 80 that you really own the domain — that's why HTTP must work first.
Your goal
Get nginx running on HTTP, customise the homepage, obtain a TLS certificate, and verify that HTTPS responds. The link is live as long as the lab session runs.
Exercises
1. nginx answers on HTTP
Concept: HTTP reachability. The first step of any deploy pipeline: is a web server even responding? Without
200 OKon port 80, the HTTPS pipeline can't run later either (Let's Encrypt needs port 80 for the challenge).Make sure nginx is running and check:
sudo systemctl enable --now nginx curl -sI http://localhost/Getting
502? Then look atsudo systemctl status nginx.Check:
curl -sI http://localhost/returns anHTTP/... 200status line.2. Customize index.html
Concept: document root. nginx serves files from a directory — the document root (
/var/www/lab/). The homepage isindex.html. Make it your own.Edit
/var/www/lab/index.html(sudo nano /var/www/lab/index.html) and add the title:<h1>Meine erste eigene Webseite</h1>Check:
/var/www/lab/index.htmlcontains the textMeine erste eigene Webseite.3. HTTPS certificate retrieved
Concept: certbot & automatic configuration.
certbotwith the nginx plugin fetches the certificate and writes it into the nginx config automatically (thessl_certificateline then points to/etc/letsencrypt/live/...).Obtain the certificate for your lab domain (certbot asks for it or uses the prepared one):
sudo certbot --nginx --non-interactive --agree-tos -m student@example.comcertbot also sets up the HTTP→HTTPS redirect.
Check:
/etc/nginx/sites-enabled/lab-deploy.confcontainsssl_certificate /etc/letsencrypt/live/....4. HTTPS responds with 200 OK
Concept: final check. Does nginx now really speak TLS and serve your page over HTTPS?
301/302(HTTP→HTTPS redirect) also count as success.curl -sIk https://localhost/-kignores the cert hostname mismatch (the cert is for your lab domain, not "localhost"). Getting "Failed to connect to port 443"? Then certbot hasn't finished yet.Check:
curl -sIk https://localhost/returnsHTTP/... 200,301or302.
Now practice it yourself
Reading is good – doing is better. Start this course on a real Linux VM, right in your browser. A free account is all it takes.
Start for freeLab content under CC BY 4.0 – free to use with attribution (© TechLogia).
