Nginx
Reverse proxy, TLS termination and static files.
Nginx is taught here in 13 lessons, running from Server blocks and static files through to nginx in containers and as a Kubernetes ingress. Each lesson takes one topic, shows the working code, and links onward to the next, so the course can be read straight through in order.
| Track | DevOps & Tooling |
| Lessons | 13 |
| Level | Beginner to intermediate |
| Reading time | about 3 hours |
| Prerequisites | Helpful, but not required: Kubernetes |
Lessons
- Server blocks and static filesHow nginx chooses a virtual host, how root and alias resolve a path, and how to reload a config safely.
- Reverse proxy and TLSPut an application behind nginx, forward the headers it needs, and terminate HTTPS in one place.
- Caching, compression and trapsCache responses safely, compress the right things, and recognise the configuration mistakes that cause most incidents.
- Installing nginx and understanding the configuration layoutPackage and source installs, the main, events and http contexts, conf.d versus sites-available, include order, and testing and reloading safely.
- How nginx matches a request: locations and rewrite phasesExact, prefix and regex location precedence, the order of the rewrite and access phases, return versus rewrite, and a method for reading an unfamiliar config.
- Rewrites, redirects and try_filesReturn 301 and 302, rewrite flags last and break, try_files for single-page apps and fallbacks, trailing slash normalisation, and diagnosing redirect loops.
- TLS hardening and certificates with Let's EncryptCertificate chains, modern protocol and cipher choices, session caching, OCSP stapling, HSTS, and automated issuance and renewal with certbot.
- Load balancing and upstreamsUpstream blocks, round-robin, least_conn and ip_hash, weights, backup servers, passive and active health checks, and draining a node without dropping requests.
- Rate limiting, access control and security headerslimit_req and limit_conn with burst and nodelay, allow and deny rules, basic auth, blocking bad clients, and the headers that reduce real risk.
- WebSockets, gRPC and streaming responsesUpgrade headers for long-lived sockets, timeouts and buffering for streaming, gRPC proxying with HTTP/2, and disabling buffering for server-sent events.
- Logging, metrics and debugging a configCustom log formats, structured JSON access logs, error log levels, request IDs, stub_status metrics, and isolating a problem by bisecting the config.
- Performance tuning: workers, buffers and timeoutsWorker processes and connections, sendfile and tcp_nopush, buffer sizing, keepalive timeouts, file descriptor limits, and how to benchmark a change.
- nginx in containers and as a Kubernetes ingressConfigure with templates and environment variables, run as a non-root user, use the ingress controller, and understand annotations and canary routing.
More in DevOps & Tooling
Git Linux Docker Kubernetes CI / CD Bash Scripting Ansible
FAQ
How long does the Nginx course take?
It has 13 lessons, about 3 hours of reading. Expect roughly twice that if you type out and run every example.
Do I need prior experience for Nginx?
Not strictly. It helps to have read Kubernetes first, because some lessons build on it, but every lesson explains its own assumptions.
What should I read after Nginx?
Continue with CI / CD (12 lessons), the next course in DevOps & Tooling.