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
Intro
NGINX Fundamentals
NGINX is a web server, reverse proxy, and load balancer. It accepts HTTP (and other protocol) connections, decides what to do with each request based on its configuration, and either serves a file directly or hands the request to another process. It runs some of the busiest sites on the internet because of how it handles concurrency: one small set of worker processes serves thousands of simultaneous connections without spawning a thread or process per connection.
The useful mental model is a request router with a rulebook. The rulebook is the configuration file. Every incoming request gets matched against that rulebook — first to a virtual server, then to a location inside it — and the matched rule decides what happens next: serve a file, proxy to a backend, redirect, or reject.
Why NGINX exists
Early web servers like Apache HTTP Server handled each connection with a dedicated process or thread. That model is simple to reason about, but it does not scale gracefully when a server needs to hold open thousands of slow or idle connections — the C10K problem. NGINX was built around an event-driven, asynchronous architecture instead: a fixed number of worker processes each run an event loop and multiplex many connections without blocking on any single one.
That architecture makes NGINX a natural fit for jobs that involve high connection counts or connection reuse, not just raw CPU-bound page rendering:
- serving static files (HTML, images, CSS, JavaScript) at high concurrency;
- terminating TLS in front of application servers;
- reverse-proxying requests to application backends (PHP-FPM, Node.js, Python WSGI/ASGI apps, Java application servers);
- load balancing across multiple backend instances;
- acting as an API gateway or edge cache.
Master and worker processes
An NGINX instance is a master process plus one or more worker processes.
- The master process reads and validates the configuration file, opens listening sockets, and manages workers — starting, stopping, and restarting them as needed. It does not handle client requests itself.
- Worker processes do the actual work: accepting connections, reading requests, running the configured logic, and talking to upstream servers. Each worker runs an event loop and can hold many connections open at once.
Continue the course
This section is part of the paid course.
See pricing to subscribe, or log in if you already have access.
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
- 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
