NGINXCaddy
Web servers and proxies
nginx and Caddy: serve sites, proxy apps, handle HTTPS, cache and tune.
- 8 lessons
- 3h 4m estimated time
- 1 hands-on lab
- 2 animated diagrams
- 8 quizzes
2 beginner, 6 intermediate. Start at the top or pick a chapter below.
First server
Serve a site with nginx or Caddy.
01 Up next Nginx from scratch on Ubuntu: install, server blocks, reload Nginx is a web server that reads its rules from config files, so you install it, describe a site in a server block, test the syntax and reload it. 20 min Beginner Lab 03 Up next Caddy from scratch: Caddyfile, file_server and reverse_proxy Caddy is a web server configured by a short Caddyfile, where a site address plus file_server or reverse_proxy is enough to serve a site with automatic HTTPS. 20 min Beginner
Proxy and HTTPS
Put an app behind a proxy with HTTPS and WebSockets.
02 Up next Nginx reverse proxy for a Node app: headers, paths, timeouts An nginx reverse proxy for a Node app forwards requests to a local port with proxy_pass and passes headers so the app still knows the real host, client IP and scheme. 25 min Intermediate Diagram 04 Up next Nginx HTTPS with certbot: what it edits and how to harden it Certbot with the nginx plugin proves you own a domain, saves a Let's Encrypt certificate under /etc/letsencrypt/live and edits your server block to serve HTTPS. 25 min Intermediate 07 Up next Websockets through a proxy: nginx Upgrade headers and SSE A websocket starts as an HTTP request with an Upgrade header, so a proxy must pass that header, use HTTP 1.1 to the app and keep idle connections open long enough. 22 min Intermediate
Speed, safety and scale
Cache, limit abuse and balance load.
05 Up next Gzip and caching headers in nginx: Cache-Control, ETag, expires Gzip shrinks text responses on the wire, and Cache-Control tells browsers how long to reuse a file, so long caching goes on hashed assets and never on index.html. 22 min Intermediate 06 Up next Nginx rate limiting and security headers: limit_req and HSTS Nginx rate limiting caps how fast one client can send requests with limit_req, and security headers such as HSTS and X-Content-Type-Options tell browsers to apply safer behavior. 25 min Intermediate 08 Up next Load balancing across two backends with nginx upstream Load balancing in nginx means listing several servers in an upstream block and pointing proxy_pass at it, so requests are shared and a failed server is skipped. 25 min Intermediate Diagram