In plain English A fast, popular program that sends web pages to visitors and can pass requests on to apps behind it.
Nginx (pronounced “engine-x”) is an open-source web serverWeb server The program that answers visitors’ browsers and sends them your website. Also used for the computer it runs on. More about Web server → and reverse proxy. It serves a large share of the world’s busiest websites and is the usual choice on new VPSVPS A private slice of a powerful server, with its own guaranteed share of memory and processing and full control, at a fraction of the price of a whole machine. More about VPS → setups. It is known for handling many simultaneous connections with little memory.
How it differs from Apache
Nginx handles connections with a small number of event-driven worker processes rather than a process or thread per connection, which keeps memory steady under heavy traffic. It does not run PHP itself: it passes PHP requests to PHP-FPM. It also has no equivalent of Apache‘s .htaccess files, so all configuration lives in the main files, which is faster but means changes need server access.
Where things are
| Path | What it holds |
|---|---|
/etc/nginx/nginx.conf | Main settings |
/etc/nginx/sites-available/ and sites-enabled/ | Site files on Debian and Ubuntu |
/etc/nginx/conf.d/ | Site files on AlmaLinux, Rocky and RHEL |
/var/log/nginx/error.log | The first place to look when something breaks |
Each site is a server block. After any change, test, then reload:
sudo nginx -t
sudo systemctl reload nginx
A reload applies the new configuration without dropping visitors. The errors Nginx itself produces most often are 502 Bad Gateway and 504 Gateway Timeout, both meaning a problem with the program behind it. Installation is covered in how to install Nginx on Ubuntu.