NGINX Fundamentals
NGINX is a high-performance web server, reverse proxy, and load balancer. It handles concurrent connections efficiently through an event-driven, non-blocking architecture, serving static content, proxying to application backends, terminating TLS, and routing traffic based on configurable rules.
itWeb servers, proxies, and traffic management | OpenSkills.info
Course pathWalk it in order
Look it upDip in anytime
Go furtherLeaves this page
Don't Panic
Don't Panic — NGINX Fundamentals
NGINX is the bouncer, receptionist, and courier standing in front of a web application. A request arrives, NGINX reads its rulebook, and it either serves a file or forwards the request to a backend. Before this style of server, a common approach gave each connection its own process or thread. That works until a great many slow connections arrive and begin consuming the furniture.
The important machinery is the master process and its workers. The master reads the configuration, opens the listening sockets, and manages workers. The workers handle connections through event loops, each keeping many conversations moving without waiting for one sleepy client to finish a sentence. This is why a small worker set can carry a large number of connections, provided the operating system also allows enough open files.
The rulebook is a tree, which is NGINX's polite way of admitting that its configuration has geography. The main, events, and http contexts set the terrain. A server block chooses a virtual server from the connection address, port, and Host header. A location block then chooses what to do with the request URI: serve a file, hand it to an application, redirect it, or return an error.
Here is the surprise that earns its keep. A broad location is not necessarily the winner. NGINX checks an exact match first, remembers the longest prefix, and can then let the first matching regular expression take over. The ^~ modifier changes that result. When a request seems to be obeying a different rule than the one underlined on your screen, it is usually following this selection path with unnerving literalness.
Configuration changes are less dramatic than they look. A reload has the master check the new configuration first. If it is invalid, the old configuration keeps serving traffic. If it is valid, new workers start and old workers finish their current work. That is a graceful handoff, not sorcery, although it is acceptable to appreciate the distinction.
Read the Intro when you need the full architecture and request path. Use Slides for the selection flow and context map. Keep the Cheatsheet nearby when root, alias, try_files, or a location modifier appears in a configuration review. The Practice tab turns that map into requests you can observe, while the next NGINX courses take the proxy, load-balancing, and security branches beyond this foundation.
Where this skill leads
Relevant careers
See how this topic contributes to broader role-level skill maps.
Sources
- https://nginx.org/en/docs/beginners_guide.html
Supports
- Master/worker process architecture and the event-based model
- Configuration file structure: simple and block directives, contexts (main, events, http, server, location)
- Control signals via nginx -s (stop, quit, reload, reopen) and via kill
- Reload behavior: syntax validation, new workers started, old workers finish and exit
- Serving static content with root, longest-prefix location selection
- Minimal reverse proxy example with proxy_pass and a regex location for static assets
- Minimal FastCGI proxying example with fastcgi_pass and fastcgi_param
- https://nginx.org/en/docs/http/request_processing.html
Supports
- Two-stage virtual server selection: listen address/port, then Host header against server_name
- default_server as a listen parameter scoped to one address:port
- Fallback behavior when Host header is missing or matches no server_name
- https://nginx.org/en/docs/http/ngx_http_core_module.html
Supports
- location matching modifiers (=, none, ^~, ~, ~*, @) and the overall selection algorithm
- server_name matching priority: exact, longest *.wildcard, longest wildcard.*, first regex
- listen directive syntax and default address/port behavior
- root vs alias path-mapping behavior, including alias with regex capture groups
- try_files directive behavior and framework front-controller pattern
- https://nginx.org/en/docs/ngx_core_module.html
Supports
- worker_processes syntax, default, and auto behavior
- worker_connections syntax, default, and context
- worker_rlimit_nofile purpose and relationship to worker_connections
- worker_shutdown_timeout behavior during graceful shutdown
- https://nginx.org/en/docs/http/load_balancing.html
Supports
- Supported load-balancing methods: round-robin (default), least_conn, ip_hash, least_time
- upstream block syntax and weighted server distribution
- Passive health-check parameters max_fails and fail_timeout
- https://nginx.org/en/docs/http/configuring_https_servers.html
Supports
- Minimal HTTPS server block with listen ssl, ssl_certificate, ssl_certificate_key
- SSL session cache and session timeout for handshake performance
- keepalive_timeout as a complementary performance setting
- https://nginx.org/en/docs/
Supports
- Overall documentation map used to scope this course against the follow-on load balancing and security hardening courses
- https://nginx.org/en/docs/switches.html
Supports
- Command-line syntax for configuration testing, configuration dumping, and selecting configuration paths
- https://nginx.org/2011.html
Supports
- First public NGINX release on 2004-10-04
- NGINX 1.0.0 stable release on 2011-04-12
- Establishment of NGINX, Inc. in 2011
- https://nginx.org/2013.html
Supports
- NGINX 1.3.13 WebSocket proxying release on 2013-02-19
- https://blog.nginx.org/blog/nginx-1-9-5
Supports
- NGINX Open Source 1.9.5 HTTP/2 support and SPDY replacement in 2015
- https://mailman.nginx.org/pipermail/nginx-announce/2016/000172.html
Supports
- NGINX 1.9.13 UDP support in the stream module on 2016-03-29
- https://blog.nginx.org/blog/nginx-1-13-10-grpc
Supports
- NGINX Open Source 1.13.10 native gRPC support in 2018
- https://nginx.org/en/docs/quic.html
Supports
- QUIC and HTTP/3 support available since NGINX 1.25.0
- https://nginx.org/download/
Supports
- NGINX release archive used to date the 1.25.0 release
- https://docs.nginx.com/nginx-ingress-controller/overview/design/
Supports
- Frequent reloads with long-lived connections can overlap worker generations and increase memory use
- https://nginx.org/en/docs/http/ngx_http_stub_status_module.html
Supports
- accepted and handled connection counters and their relationship to resource limits
- https://nginx.org/
Supports
- NGINX Open Source product and documentation home
- https://httpd.apache.org/
Supports
- Apache HTTP Server product home
- https://www.haproxy.org/
Supports
- HAProxy product home
- https://www.envoyproxy.io/
Supports
- Envoy product home
- https://caddyserver.com/
Supports
- Caddy product home
- https://traefik.io/traefik/
Supports
- Traefik Proxy product home
