Internative Logo

What Is Nginx? Web Server, Reverse Proxy and Load Balancer

What Is Nginx? Web Server, Reverse Proxy and Load Balancer

In the early 2000s, a busy website could bring a well-configured server to its knees simply by having too many visitors connected at once. Servers of the time typically gave each connection its own process or thread, so ten thousand slow clients meant ten thousand workers waiting on the network and eating memory. Nginx was written to solve exactly that problem, known as C10K, and the design it chose is why it now sits in front of a large share of the web.

This article explains what Nginx is, how its architecture works, what it is used for, when another server fits better, and how it compares with Apache, HAProxy and newer options.

What is Nginx?

Nginx (pronounced "engine-x") is an open-source web server that is also used as a reverse proxy, load balancer, HTTP cache and TCP/UDP proxy. It serves static files itself and passes dynamic requests to application servers written in PHP, Node.js, Python, .NET or any other language.

Igor Sysoev started writing Nginx while working at Rambler, a large Russian web portal, to handle its traffic. The first public version, 0.1.0, was released on 4 October 2004 under a permissive two-clause BSD licence. In 2011 Sysoev and partners founded NGINX, Inc. to offer support and a commercial edition, NGINX Plus. F5 announced its acquisition of the company in March 2019 and completed it in May 2019. The open-source nginx project continues alongside the commercial products, with a mainline branch for new features and a stable branch for production.

How Nginx works

Event-driven workers. Nginx runs one master process and a small number of worker processes, usually one per CPU core. The master reads the configuration and manages the workers; the workers handle connections. Each worker uses the operating system's event notification (epoll on Linux, kqueue on BSD) and non-blocking I/O, so a single worker can serve thousands of connections at once without creating a thread for each. Memory use stays low and predictable even with many slow clients.

Configuration as nested blocks. Everything lives in a text configuration: an http block, server blocks for each site or host name, and location blocks that match URL paths and decide what to do with them, such as serve a file, proxy to an upstream or return a redirect. nginx -t checks the configuration for syntax errors before you apply it, and nginx -s reload loads a new configuration gracefully, without dropping open connections.

Proxying to applications. Nginx does not run application code itself. It passes PHP requests to PHP-FPM over FastCGI, and forwards other requests over HTTP to application servers such as a Node.js process, Gunicorn for Python or Kestrel for ASP.NET Core. Microsoft's own documentation describes Nginx as a reverse proxy in front of Kestrel on Linux.

Key features

  • Static file serving with efficient use of the kernel's sendfile, compression and cache headers.
  • Reverse proxy for HTTP, WebSocket and gRPC traffic, with header rewriting and timeouts per route.
  • Load balancing across upstream servers with round-robin, least-connections or IP-hash methods, plus passive health checks.
  • TLS termination, so certificates and encryption are handled in one place in front of the applications.
  • HTTP/2 and HTTP/3 support; QUIC and HTTP/3 were added in the 1.25 mainline release in 2023.
  • Content caching of upstream responses, which can take most of the read load off an application.
  • Rate and connection limiting, access rules and request size limits as a first line of defence.
  • Modules, both built in and dynamically loaded, for features such as image filters, headers and scripting with njs.

Where Nginx is used

  • In front of application servers, terminating TLS, serving assets and forwarding API requests.
  • Load balancing a group of identical application instances, on virtual machines or bare metal.
  • API gateways that route, limit and log traffic for several back-end services.
  • Static sites and CDN origins, where speed and low resource use matter most.
  • Containers and Kubernetes, as a small web server inside images and as the basis of ingress controllers. The Kubernetes project retired its community Ingress NGINX controller, with maintenance ending in March 2026; F5's NGINX Ingress Controller is a separate product.

When to choose Nginx, and when not to

Choose Nginx when:

  • The application runs in its own server process and needs a fast, stable proxy in front of it.
  • Many concurrent or slow connections are expected, such as mobile clients, long polling or WebSockets.
  • You want TLS, compression, caching and static files handled outside the application.
  • You need one tool that can act as web server, proxy and simple load balancer.

Look elsewhere when:

  • Users need to change server behaviour per directory with .htaccess files, as on shared hosting. Apache or LiteSpeed support that model; Nginx does not.
  • Load balancing is the main job and you need active health checks, detailed connection statistics or advanced TCP features. HAProxy is built for that, and in the Nginx family active health checks are an NGINX Plus feature.
  • You want automatic HTTPS with almost no configuration. Caddy obtains and renews certificates by default.
  • The team runs Windows and .NET Framework applications. Microsoft IIS integrates with that stack more naturally.

Nginx and its alternatives

ServerArchitectureStrengthBest fit
NginxEvent-driven workersProxying, static files, low memoryFront of modern application stacks
Apache HTTP ServerModules, process or thread MPMs.htaccess, module ecosystemShared hosting, legacy PHP apps
LiteSpeedEvent-driven, Apache-compatiblePHP performance, built-in cacheWordPress and PHP hosting
HAProxyEvent-driven proxyAdvanced load balancing, health checksDedicated load-balancing tier
CaddyGo, single binaryAutomatic HTTPS, simple configSmall services and quick setups

The classic comparison is Nginx vs Apache. Apache is older and more flexible per directory, and runs PHP inside the server with mod_php; Nginx handles many connections with less memory and leaves PHP to PHP-FPM. In practice many setups use both: Nginx in front for TLS and static files, Apache or an application server behind it. In cloud setups, a CDN such as Cloudflare often sits in front of Nginx as well.

How we use Nginx at Internative

We use Nginx for high availability, performance and secure traffic management. It plays a key role in our production infrastructure, our API gateways and the scalable deployment architectures we build for clients.

If you are planning how traffic should reach your application, or moving a service to a more resilient setup, our DevOps services team can help you design the layer in front of it.

Frequently asked questions

Why do we use Nginx?

Nginx is used to serve websites and to stand in front of applications. It serves static files quickly, terminates HTTPS, forwards requests to application servers, spreads load across several instances and caches responses, all with low memory use even when many clients are connected.

How do you pronounce Nginx?

The project's own pronunciation is "engine-x". The name is usually written in lower case as nginx for the open-source software and as NGINX for the company and its commercial products.

Is Nginx still used and popular?

Yes. Nginx remains one of the most widely deployed web servers and reverse proxies, both on traditional servers and inside containers. The open-source project and F5's commercial products continue to receive regular releases.

Which is better, Nginx or Apache?

Neither is better everywhere. Nginx handles high concurrency with less memory and is the usual choice as a reverse proxy. Apache offers per-directory .htaccess configuration and a large module ecosystem, which suits shared hosting. Many systems run Nginx in front of Apache or an application server.

What is a reverse proxy?

A reverse proxy is a server that receives requests from clients and forwards them to one or more back-end servers, then returns their responses. Clients only see the proxy, which can add TLS, caching, compression, load balancing and access control without changing the application.

Related services

Where this topic becomes an engagement.

Keep reading

The articles that follow this one.