How Nginx Handles Thousands of Connections With One Thread
Nginx uses a master/worker process architecture where each worker runs a single-threaded event loop handling thousands of connections simultaneously. This is why it can serve 10,000+ concurrent connections on hardware where thread-per-request servers fall over.
The config file maps requests through a hierarchy of http, server, and location blocks. Server blocks match on the Host header, while location blocks follow a fixed priority order: exact match, then ^~ prefix, then regex, then longest prefix. Most routing bugs come from misunderstanding this precedence.
In practice, nginx handles six jobs: static files, reverse proxying, load balancing, TLS termination, caching, and rate limiting. The common gotchas that trip up every team involve trailing slashes on proxy_pass, missing proxy headers, and the default 1MB body size limit.