Skip to content
BENIBIX Learn

Nginx

Infrastructure🌍 Web Serving & NginxWeb Servers

Also known as Engine X, Nginx Web Server

A fast, free web server. It can also stand in front of your apps.

Think of it like

It is like a fast waiter. He can serve lots of tables at once.

Example

Jack installs Nginx on his Ubuntu server. It sends his images straight from disk and passes every other request to his Node.js app.

Why it matters

It is one of the most used web servers in the world. Most server guides you meet will use it.

Definition

Nginx is a free, open-source web server. It can handle many visitors at once and use little memory. One master process reads the settings. Worker processes answer the requests. It often sits in front of apps as a reverse proxy. It can also serve files, handle TLS and cache answers.

Example code

console
$ sudo nginx -t
nginx: the configuration file /etc/nginx/nginx.conf syntax is ok
nginx: configuration file /etc/nginx/nginx.conf test is successful
$ sudo nginx -s reload
Test the settings first, then reload. If the new settings are broken, Nginx keeps the old ones.
Nginx is one choice for the web server in the middle. It serves files and passes app requests on.

Common mistake

Changing the settings and reloading without a test. One typo can stop the reload, so run nginx -t first.

Key takeaways

  1. 1
    Many at once. Built to handle lots of connections.
  2. 2
    Master and workers. One reads settings, the rest answer.
  3. 3
    Proxy too. It often stands in front of an app.

Compare