0:00–0:10
Recap
0:10–0:40
Lecture
0:40–1:50
Lab 4C
1:50–2:00
Debrief
0:00 – 0:10Recap · 10 min

DNS verified — now build the web server it points to

0:10 – 0:40Lecture · 30 min

Nginx architecture, server blocks, SSL/TLS fundamentals, the snippet approach

Part 1 — Nginx as a web server (8 min)

Part 2 — Server block anatomy (8 min)

Part 3 — SSL/TLS and the self-signed certificate (10 min)

Part 4 — nginx -t (4 min)

0:40 – 1:50Lab 4C · 70 min

Lab 4C — Install Nginx, virtual host, SSL certificate, DH parameters, HTTPS server block

Part 1 — Install and verify (5 min)

Part 2 — Create virtual host for yourname.net (20 min)

Part 3 — Generate SSL certificate and DH parameters (15 min)

Part 4 — Create SSL snippet files (15 min)

Part 5 — Add HTTPS server block (15 min)

Lab 4C complete when: http://yourname.net returns a 301 redirect to HTTPS. https://yourname.net loads the index.html page. Certificate warning appears (expected for self-signed). Per-site log files exist in /var/log/nginx/.
1:50 – 2:00Debrief · 10 min

Learning outcomes — by end of Day 3, students can…

Create an Nginx virtual hostWrite a server block, link it into sites-enabled, and verify with nginx -t and curl
Generate a self-signed TLS certificateUse openssl req -x509 with correct flags and explain what each flag does
Configure SSL using the snippet approachCreate self-signed.conf and ssl-params.conf, include them in a server block, and explain why snippets are used
Implement HTTP to HTTPS redirectWrite a 301 return directive in the port 80 server block and verify the redirect with curl -v

Common issues and fixes

IssueLikely causeFix
nginx -t fails: "dhparam.pem: No such file"DH parameter generation not yet complete or was run in foreground and interruptedCheck: ls -lh /etc/nginx/dhparam.pem. If missing or 0 bytes, re-run: sudo openssl dhparam -out /etc/nginx/dhparam.pem 4096 (allow 2–5 minutes)
Browser shows "Connection refused" instead of cert warningPort 443 not open in UFW, or Nginx not listening on 443Check: sudo ss -tlnp | grep nginx. If port 443 missing, check nginx -t for errors in the HTTPS server block. Also: sudo ufw allow 443/tcp
http://yourname.net loads the site instead of redirectingPort 80 server block still has root/location directives instead of just return 301The port 80 block must only have listen, server_name, and return 301. Remove all root, index, and location lines from it
Visiting http redirects but HTTPS shows 404Document root path wrong, or index.html missingCheck: ls /var/www/yourname.net/html/index.html. Verify root directive in HTTPS server block matches the actual path
← Day 2 Lab 4C Handout Day 4 →