What is NGINX?

NGINX is a web server, reverse proxy and load balancer built to hold tens of thousands of open connections with very little memory. It fronts a large share of the busiest sites on the internet.

What problem was NGINX designed to solve?

It was written to serve many simultaneous clients without one process or thread per connection. Older servers that dedicated a worker to each visitor ran out of memory when thousands of slow mobile clients connected at once. NGINX instead runs a small number of worker processes, each with an event loop that watches thousands of sockets through epoll on Linux and handles whichever one is ready. A single worker can juggle a huge number of idle keep-alive connections for a few kilobytes each.

What is NGINX used for?

Four jobs cover most installations, and one instance often does all of them at once:

How is a configuration organised?

In nested blocks. The http block holds global web settings, each server block describes one site by its listen port and server names, and location blocks inside it decide how matching paths are handled. On Debian and Ubuntu, site files live in /etc/nginx/sites-available and are enabled by a symlink; on AlmaLinux, Rocky and Fedora, drop them in /etc/nginx/conf.d. A compact site that serves files and hands PHP to FPM looks like this:

server {
    listen 443 ssl;
    listen [::]:443 ssl;
    http2 on;
    server_name shop.example.net;
    root /srv/shop/public;
    ssl_certificate     /etc/letsencrypt/live/shop.example.net/fullchain.pem;
    ssl_certificate_key /etc/letsencrypt/live/shop.example.net/privkey.pem;
    location / { try_files $uri $uri/ /index.php?$query_string; }
    location ~ \.php$ {
        include fastcgi_params;
        fastcgi_param SCRIPT_FILENAME $realpath_root$fastcgi_script_name;
        fastcgi_pass 127.0.0.1:9083;   # pool listening on a loopback port
    }
}

Test before every reload with nginx -t, then apply with systemctl reload nginx; a reload swaps workers gracefully without dropping open connections.

How does NGINX compare with Apache?

Both are excellent; they make different trade-offs. Apache with the event MPM is close to NGINX in raw throughput today and still offers per-directory .htaccess overrides, which shared hosting panels rely on. NGINX has no per-directory files, so every rule lives in the main configuration, which is faster and easier to audit on a server you control alone. A common pattern on a dedicated machine is NGINX in front for TLS, static files and caching, with the application server behind it. Our Install a LAMP stack guide shows the Apache route if your software expects it.

How should workers be tuned on a many-core server?

Let NGINX match the hardware and raise the file limits. With worker_processes auto it starts one worker per logical CPU, so ESSENTIAL-M with 12 runs that many event loops. Each connection uses a file descriptor, and a proxied request uses two, so raise worker_rlimit_nofile and the systemd LimitNOFILE together:

worker_processes auto;
worker_rlimit_nofile 131072;
events { worker_connections 16384; multi_accept on; }

Twenty-four workers at 16,384 connections each could in theory hold about 390,000 sockets, far above what one 1 Gbps port will carry for real traffic, so the network rather than NGINX becomes the ceiling. Machines on the Business line line start at a 3 Gbps guaranteed port when that matters.

Can NGINX cache responses?

Yes. The proxy_cache family stores upstream responses on disk under a key you choose, with an in-memory index sized by keys_zone. On a server with NVMe drives, a cache of tens of gigabytes answers repeated requests in microseconds and shields the application during traffic spikes. Set proxy_cache_use_stale updating error timeout so visitors keep receiving the last good page while the backend restarts. For heavily dynamic sites, even a one-second micro-cache flattens bursts dramatically.

What do I need to run it here?

Nothing beyond the operating system. NGINX is packaged in every distribution we install, including Ubuntu Server, Debian and AlmaLinux. Since each machine has one IPv4 address, NGINX is the natural way to host many domains side by side: it chooses the right certificate from the name the browser sends during the TLS handshake. Our High-traffic websites page sizes machines for busy sites.

Machines that suit an NGINX front end

ModelProcessorCoresMemoryDrivesPortPer month
ESSENTIAL-1Intel Xeon-E 2386G632 GB2x 512 GB SSD NVMe1 Gbps unmetered$38.40
ESSENTIAL-MAMD Ryzen 9 9900X1264 GB2x 512 GB SSD NVMe1 Gbps unmetered$70.80
BUSINESS-1 2024AMD EPYC 4244P632 GB2x 960 GB SSD NVMe3 Gbps unmetered$81.60
BUSINESS-3 2026AMD EPYC 4465P1264 GB2x 960 GB SSD NVMe3 Gbps unmetered$184.20

Related pages

What server hosting means

Server hosting explained: shared, virtual, dedicated and colocated, what the provider does in each, what you do, and how to tell which one a project needs.

Read more

Install a LAMP stack

Install Apache, MariaDB and PHP on Debian, Ubuntu or the Enterprise Linux family, add a virtual host and HTTPS, and tune it for the hardware.

Read more

High-traffic websites

Machines with fast cores and guaranteed 3 to 5 Gbps ports for news sites, forums, APIs and busy content platforms.

Read more

Load balancing

Spreading requests over several servers: layer 4 and layer 7 balancers, algorithms, health checks, sticky sessions and self-built designs with HAProxy.

Read more

Questions and answers

Is NGINX free?

Yes. The open-source NGINX server is free under a BSD-style licence and packaged by every major Linux distribution. A paid commercial edition with extra modules also exists.

Can NGINX run PHP?

Not by itself. NGINX passes PHP requests to PHP-FPM over FastCGI, through a Unix socket or a loopback port, and serves the static files directly.

How many websites can one NGINX server host?

Hundreds or more. Each site is a server block selected by name, and TLS certificates are chosen per name, so all of them can share one IPv4 address.

Does a reload drop visitor connections?

No. A reload starts new workers with the new configuration and lets the old ones finish their open requests before exiting.

How do I check an NGINX configuration for errors?

Run nginx -t. It parses every included file and reports the file and line of any mistake without touching the running server.