
Definition
Nginx is a server program that accepts HTTP, HTTPS and other network requests and decides what to do with them: serve a file directly, pass the request to an application server, cache a response, or forward it to another machine. The project's own README describes Nginx as "the world's most popular Web Server, high performance Load Balancer, Reverse Proxy, API Gateway and Content Cache."
The software was created by Russian developer Igor Sysoev and publicly released in 2004, with the release date given as 4 October 2004. Unlike a programming framework, Nginx is not where your application normally runs. It sits in front of the code and manages the network side of serving requests. Modules can extend its behavior, such as NGINX JavaScript (njs), which adds an ECMAScript-compatible interpreter for the HTTP and Stream modules. A typical setup puts Nginx in front of an application gateway, for example one built with uWSGI and Django.
How Nginx Works Internally
Nginx runs as one master process plus several worker processes. The master process reads and evaluates the configuration and maintains the workers. The workers do the actual processing of requests.
Each worker handles many connections at once rather than dedicating one process to each connection. This is the core of the design: the master stays out of the request path, and the workers carry the traffic.
When something does not work as expected, the first place to look is the logs. Errors and requests are recorded in access.log and error.log, found in /usr/local/nginx/logs or /var/log/nginx, depending on how Nginx was installed.
What Nginx Is Used For
- Static web server: serves HTML, CSS, JavaScript and images directly from disk.
- Reverse proxy: receives client requests and forwards them to one or more backend application servers.
- Load balancer: distributes requests across multiple backend instances to spread load and provide failover.
- SSL/TLS termination: handles HTTPS encryption at the Nginx layer. The documentation covers NGINX SSL Termination, including SSL termination for TCP upstreams.
- Caching layer: stores responses from slower backends to reduce repeated work.
- TCP/UDP proxy: proxies and balances non-HTTP traffic as well as web traffic.
- Mail proxy: works as a mail proxy server.
- FastCGI gateway: routes requests to FastCGI servers, which run applications built with various frameworks and programming languages such as PHP.
In a typical application deployment, Nginx is the entry point that the public internet talks to, while the application itself runs behind it on a different port or machine.
A Basic Configuration Example
Nginx is configured with plain text files, usually organized into a main configuration file and included site-specific files. The following example serves static files and proxies dynamic requests to a backend application listening on a local port.
server {
listen 80;
server_name example.com;
root /var/www/example.com/public;
index index.html;
location / {
try_files $uri $uri/ =404;
}
location /api/ {
proxy_pass http://127.0.0.1:3000;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
}
}
The location blocks match request paths and decide how each one is handled. Requests to /api/ are forwarded to the backend, while everything else is served as a static file from root.
Configuration changes are applied by sending the reload signal to the master process with nginx -s reload.
Packaged installs ship with their own defaults. On Red Hat Enterprise Linux 9, for instance, the default configuration runs Nginx as a web server on port 80 and serves content from /usr/share/nginx/html/. Check what your distribution sets up before writing your own server blocks.
Open Source, Mainline, Stable and NGINX Plus
Nginx Open Source is free to download and run. It ships in two versions. The Mainline version is the latest development version, updated approximately every one or two months, and includes the latest features, bug fixes and security fixes. The documentation recommends Mainline for production unless an organization has strict stability requirements, in which case the Stable version may be the better choice. The source code and release notes for both are available from the NGINX download page.
As of late November 2026, the current releases are nginx-1.30.8 (stable) and nginx-1.31.10 (mainline), both released on 23 November 2026 with a fix for excessive CPU usage when using ssl_early_data.
A company of the same name, Nginx, Inc., was founded in 2011 to provide support and the NGINX Plus paid software. In March 2019, F5 acquired it for $670 million. F5, Inc. now offers enterprise distributions, commercial support and training. NGINX Plus is proprietary, paid software from F5, Inc. The base server carries no license fee.
Trade-offs and When to Use It
Nginx is a strong default when a site needs to handle many concurrent connections, terminate SSL/TLS, or sit in front of multiple backend services. The configuration syntax is readable once you understand how location blocks are matched.
The trade-off is that control stays with the administrator. Nginx rules live in configuration files that typically require administrator access and a reload to apply. That makes it less convenient where individual users need to change server behavior themselves, but more predictable and easier to audit on servers an administrator fully controls.
Common Mistakes
- Forgetting to reload. Editing a configuration file does nothing until the master process receives the reload signal (
nginx -s reload). Reload after every change, then checkerror.logbefore assuming the new rules are live. - Overlapping location blocks. When several
locationblocks could match the same path, requests can end up somewhere unintended. Keep location rules few and distinct, and read thengx_http_core_modulelocation reference for the exact matching behavior. - Forgetting to pass headers to a backend. Without directives like
proxy_set_header Host, a proxied application may see the wrong hostname or client IP, breaking redirects or logging. - Serving uncompressed or uncached static assets. Compression and cache headers need to be configured deliberately. The Compression and Decompression admin guide explains how.
Common questions
Is Nginx free to use?
Yes. Nginx Open Source was originally written by Igor Sysoev and is distributed under a simplified 2-clause BSD-like license, so it is free to download and run. F5, Inc. offers enterprise distributions, commercial support and training, plus the paid NGINX Plus product.
Can Nginx run PHP directly?
Not in the way a PHP-enabled module would. Nginx can route requests to FastCGI servers, which run applications built with various frameworks and programming languages such as PHP. Nginx passes the request along and returns the response to the client.
Does Nginx work as a load balancer?
Yes. Nginx works as a load balancer for HTTP, TCP and UDP servers, spreading incoming requests across several backend servers. HTTP, TCP, UDP and gRPC health checks are documented in the NGINX Plus admin guide.
What is the difference between Nginx and NGINX Plus?
Nginx Open Source is the free core server. NGINX Plus is proprietary, paid software from F5, Inc., sold with commercial support.
Should I use the Mainline or Stable version?
The documentation recommends the Mainline version for production unless your organization has strict stability requirements. In that case, the Stable version may be the better choice. Source code and release notes for both are on the NGINX download page.
Sources
About this page
Last reviewed December 3, 2026 by the Better Studio editors. Read our editorial policy or report an error.