HTTP web server, reverse proxy, content cache, load balancer, TCP/UDP proxy server, and mail proxy server
open coreBSD-2-Clauseself-hostablefree
nginx ("engine x") is an open source HTTP web server, reverse proxy, content cache, load balancer, TCP/UDP proxy and mail proxy, originally written by Igor Sysoev and stewarded by F5 since F5 acquired NGINX, Inc. in 2019. One master process and several unprivileged, event-driven worker processes serve static files, proxy and cache HTTP, FastCGI, uwsgi, SCGI and memcached backends, terminate TLS with SNI and speak HTTP/2 and HTTP/3, and the configuration or even the binary can be swapped without interrupting clients. It is extended with modules, including dynamic ones, and scripted with njs (JavaScript) or embedded Perl. Licensed BSD-2-Clause; F5 sells NGINX Plus, an enterprise distribution with active health checks, API-driven reconfiguration and commercial support.
Ways to install
On your own server
Hosted for you
Package managers
Problems it solves
- serve a static website fast from my own Linux server with gzip compression and an open file cache
- put one front door in front of several web apps on different ports and route by domain name
- terminate HTTPS for my backend services and pass the requests on to them over plain HTTP
- load balance requests across a few app servers and stop sending traffic to one that fails
- cache responses from a slow backend so repeat requests never reach the app
- run a PHP app through php-fpm behind a web server using FastCGI
- rate limit requests and connections per IP address to stop a scraper hammering my site
- proxy raw TCP or UDP traffic, like a database or DNS, to a pool of backend servers
- reload my web server config or upgrade its binary without dropping the connections already open
- serve my site over HTTP/2 and HTTP/3 from my own server
- host several websites on one server with name-based virtual hosts
- stream MP4 and FLV video files with seeking from a plain web server
- proxy IMAP, POP3 and SMTP connections to backend mail servers after checking logins with an HTTP auth service
- restrict an admin path to certain IP addresses or put it behind HTTP basic auth
- copy production traffic to a test backend to try a new version against real requests
- a web server that keeps ten thousand idle keep-alive connections in a few megabytes of memory
- buy a supported enterprise build of our web server with active health checks and live reconfiguration through an API
- serve a static website and its assets fast from my own server
- put a reverse proxy in front of my Rails, Node or Python app server
- terminate HTTPS in front of several apps on one machine
- load balance requests across several backend servers
- cache responses from a slow backend so repeat requests don't hit it
- rate limit clients that hammer my API
- route different domains and paths to different services on one IP
- proxy raw TCP or UDP traffic such as a database or DNS through one front door
- serve large file downloads and video efficiently with byte-range support
- redirect HTTP to HTTPS and add security headers for every site
- a mail proxy in front of IMAP, POP3 and SMTP servers
Features
- static and index file serving, autoindexing and an open file descriptor cache
- reverse proxy with caching, load balancing and fault tolerance
- caching for FastCGI, uwsgi, SCGI and memcached backends
- filters including gzip, byte ranges, chunked responses, XSLT, SSI and image transformation
- SSL/TLS with SNI, HTTP/2 with prioritization, and HTTP/3
- name-based and IP-based virtual servers, keep-alive and pipelined connections
- access logs with buffering, log rotation and syslog
- regex URI rewriting, conditional execution and error-code redirects
- access control by IP, HTTP basic authentication and auth subrequests
- response rate limiting and per-address connection and request limits
View 7 more
- WebDAV methods, FLV and MP4 streaming, IP geolocation, A/B testing and request mirroring
- embedded Perl and njs (JavaScript) scripting
- mail proxy for IMAP, POP3 and SMTP with external HTTP authentication, SSL and STARTTLS
- generic TCP and UDP proxy with TLS, SNI, load balancing and access control
- master process with unprivileged workers; reconfiguration and binary upgrades without interrupting clients
- event mechanisms kqueue, epoll, /dev/poll and event ports; sendfile, AIO and DIRECTIO
- dynamic modules loaded with load_module
Limitations
- Doesn't support UDP or QUIC on Windows: the Windows build is a beta that runs as a console app, not a service, and only one worker process does work5
Ways to run it
nginx (open source)
Not included
- active health checks, JWT authentication and a cache purge API, which F5's commercial builds have8
- state shared across a cluster (session persistence, distributed rate limiting, synchronized key-value stores) and config sync8
- enterprise support with SLAs from F5, unless bought as a subscription for open source NGINX8
NGINX Plus
no price listed: free trial, then contact F5 (subscription or perpetual licensing)7910
Only in this edition
- active health checks, failover and state synchronization
- API-driven configuration without reloads
- 200+ real-time metrics
- TLS termination with dynamic certificate management, authentication and authorization
- enterprise support from F5
Capabilities
| Has a command line tool | plan not known |
|---|---|
| Takes plugins | plan not known |
Forks
- Angie Drop-in replacement for nginx, forked by its former developers. Its own project.
Alternatives
The same job
These do what nginx does.
- lighttpd A secure, fast, compliant and very flexible web server
- Caddy The Ultimate Server with Automatic HTTPS
- Apache HTTP Server A secure, efficient and extensible open source web server
- Thruster HTTP/2 proxy for simple production-ready deployments of Rails applications
- Traefik Proxy The Cloud Native Application Proxy
- HAProxy The Reliable, High Performance TCP/HTTP Load Balancer
