HTTP server, reverse proxy, and load balancer

nginx (“engine x”) is also a content cache, a TCP/UDP proxy, and a mail proxy. Free and open source under the 2-clause BSD License.

Install with one command

curl --proto '=https' --tlsv1.2 -fsSL https://get.nginx.org/nginx.sh | sh

Want to check it first? Read the script. Or see other ways to install.

Read the docs Beginner’s Guide

Latest: 1.31.9 mainline and 1.30.7 stable.

Configure it in a few lines

Example configuration
# Serve files from a folder
server {
    listen 80;
    server_name example.com;

    root /var/www/example;
    index index.html;

    location / {
        try_files $uri $uri/ =404;
    }
}
# Pass requests to an app on port 3000
server {
    listen 80;
    server_name app.example.com;

    location / {
        proxy_pass http://127.0.0.1:3000;
        proxy_set_header Host $host;
        proxy_set_header X-Real-IP $remote_addr;
    }
}
# Spread requests across three servers
upstream backend {
    least_conn;
    server 10.0.0.11:8080;
    server 10.0.0.12:8080;
    server 10.0.0.13:8080 backup;
}

server {
    listen 80;

    location / {
        proxy_pass http://backend;
    }
}
# TLS with HTTP/2 and HTTP/3
server {
    listen 443 ssl;
    listen 443 quic reuseport;
    http2 on;
    server_name example.com;

    ssl_certificate     /etc/ssl/example.com.crt;
    ssl_certificate_key /etc/ssl/example.com.key;

    add_header Alt-Svc 'h3=":443"; ma=86400';
    root /var/www/example;
}

Save it in /etc/nginx/conf.d/, then run nginx -s reload.

Everyday commands

nginx -t
Check the configuration for errors.
nginx -s reload
Apply a new configuration. Open connections are not dropped.
nginx -s quit
Stop after current requests finish.

More on controlling nginx

What nginx does

Fast, flexible, and light on memory. It is the world’s most popular web server, according to Netcraft.

Web server

Serves static and index files, with autoindexing and an open file cache. Supports virtual servers by name or IP.

How requests are processed

Reverse proxy and cache

Proxies and caches HTTP, FastCGI, uwsgi, SCGI, and memcached backends.

Proxy module

Load balancing

Spreads traffic across servers and keeps serving when one of them fails.

Upstream module

TLS, HTTP/2, and HTTP/3

SSL and TLS with SNI. HTTP/2 with prioritization. HTTP/3 over QUIC.

SSL module

TCP, UDP, and mail proxy

Generic proxying of TCP and UDP streams. IMAP, POP3, and SMTP proxying with external authentication.

Stream proxy module

Limits and access control

Limits requests and connections per address. Controls access by IP, password, or subrequest.

Request limit module

How it runs

  • One master process and several worker processes. Workers run as an unprivileged user.
  • Reload the configuration or upgrade the binary without interrupting clients.
  • 10,000 inactive HTTP keep-alive connections take about 2.5 MB of memory.

See the full feature list

Other ways to install

Operating system
sudo apt update
sudo apt install nginx

This installs your distribution’s version. For the latest release, use the nginx.org packages.

sudo dnf install nginx
sudo systemctl enable --now nginx

This installs your distribution’s version. For the latest release, use the nginx.org packages.

brew install nginx
brew services start nginx

Homebrew’s nginx listens on port 8080.

docker run --name nginx -p 8080:80 -d nginx

Then open http://localhost:8080.

curl -O https://nginx.org/download/nginx-1.31.9.tar.gz
tar -xzf nginx-1.31.9.tar.gz
cd nginx-1.31.9
./configure
make
sudo make install

See Installing nginx for build options.

Which version?

Mainline, 1.31.9
Has the newest features and bug fixes.
Stable, 1.30.7
Gets major bug fixes only.

Source and Windows builds

Version Source Windows Changes
1.31.9 mainline nginx-1.31.9.tar.gz pgp nginx-1.31.9.zip pgp CHANGES
1.30.7 stable nginx-1.30.7.tar.gz pgp nginx-1.30.7.zip pgp CHANGES-1.30

Latest news

  • Security nginx 1.30.7 stable and nginx 1.31.9 mainline are out.

    10 vulnerabilities fixed
    • Use-after-free in resolver (CVE-2026-123634)
    • Memory corruption in HTTP/2 flow control (CVE-2026-123007)
    • Use-after-free in HTTP/3 (CVE-2026-121810)
    • Use-after-free in HTTP/2 (CVE-2026-123633)
    • Infinite loop while reading client request body over TLS 1.3 (CVE-2026-118899)
    • Use-after-free in mail proxy module (CVE-2026-113425)
    • NULL pointer dereference when using PROXY protocol version 2 (CVE-2026-120993)
    • Buffer overflow when using alias with try_files (CVE-2026-125283)
    • SNI bypass in client certificate validation in stream module (CVE-2026-120967)
    • Insufficient validation in stream ssl_preread module (CVE-2026-123640)

    Security advisories

  • nginx 1.31.8 mainline is out.

  • Security nginx 1.30.6 stable and nginx 1.31.7 mainline are out.

    5 vulnerabilities fixed
    • Buffer overflow when using alias with rewrite (CVE-2026-15176)
    • Buffer overflow when evaluating string expressions with variables (CVE-2026-93479)
    • Request body injection in HTTP/3 (CVE-2026-95101)
    • Session forgery when using TLS session ticket key rotation (CVE-2026-97629)
    • Use-after-free when using ngx_http_ssi_module with AIO (CVE-2026-97205)

    Security advisories

  • Security njs 1.0.2 is out. Release notes

    2 vulnerabilities fixed
    • Memory exhaustion when parsing malformed XML (CVE-2026-101025)
    • Inconsistent XML attribute values affecting signed XML validation (CVE-2026-101019)

    njs security advisories

Older news

Other NGINX projects

NGINX JavaScript

njs extends nginx with an ECMAScript-compatible interpreter for the HTTP and Stream modules.

NGINX Ingress Controller

Connects Kubernetes apps and services, with auth, self-service CRDs, and easy debugging. Not the same as ingress-nginx, the separate Kubernetes community project.

NGINX Gateway Fabric

L4 and L7 routing in Kubernetes. Implements the Gateway API with NGINX as the data plane.

Running Kubernetes? See kubernetes.nginx.org.