Web server
Serves static and index files, with autoindexing and an open file cache. Supports virtual servers by name or IP.
How requests are processednginx (“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.
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.
# 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.
nginx -tnginx -s reloadnginx -s quitFast, flexible, and light on memory. It is the world’s most popular web server, according to Netcraft.
Serves static and index files, with autoindexing and an open file cache. Supports virtual servers by name or IP.
How requests are processedProxies and caches HTTP, FastCGI, uwsgi, SCGI, and memcached backends.
Proxy moduleSpreads traffic across servers and keeps serving when one of them fails.
Upstream moduleSSL and TLS with SNI. HTTP/2 with prioritization. HTTP/3 over QUIC.
SSL moduleGeneric proxying of TCP and UDP streams. IMAP, POP3, and SMTP proxying with external authentication.
Stream proxy moduleLimits requests and connections per address. Controls access by IP, password, or subrequest.
Request limit modulesudo 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.
| 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 |
Security nginx 1.30.7 stable and nginx 1.31.9 mainline are out.
nginx 1.31.8 mainline is out.
Security nginx 1.30.6 stable and nginx 1.31.7 mainline are out.
Security njs 1.0.2 is out. Release notes
njs extends nginx with an ECMAScript-compatible interpreter for the HTTP and Stream modules.
Connects Kubernetes apps and services, with auth, self-service CRDs, and easy debugging. Not the same as ingress-nginx, the separate Kubernetes community project.
L4 and L7 routing in Kubernetes. Implements the Gateway API with NGINX as the data plane.
Running Kubernetes? See kubernetes.nginx.org.