What is Nginx? Definition and How it works

What is Nginx? Read "engine-ex", Nginx is an open source web server software. When it was first released, Nginx only functioned as an HTTP web serving. But now, the software also acts as a reverse proxy, HTTP load balancer, and email proxy for IMAP, POP3, and SMTP.

Nginx was officially introduced in October 2004. The creator of this software, Igor Sysoev, started his project in 2002 to solve the C10k problem. The C10k itself is described as a challenge facing servers when it comes to managing ten thousand connections at the same time. Until now, the number of connections managed by the web server continues to grow. For this reason, Nginx offers an event-driven and asynchronous architecture. This architecture makes Nginx one of the servers whose speed and scalability can be relied on.

Due to its speed and ability to handle a large number of connections, Nginx services are often used by high-traffic websites. Some examples of these websites are Google, Netflix, Adobe, Cloudflare, WordPress.com, and many more.

How Does Nginx Work?

Before getting to know the meaning of NGINX further, it is better if you know how a web server works first. When someone "sends" a request to open a webpage, the browser will contact the website server. The server then looks for the webpage file requested by the user and sends it to the browser. This flow shows how the server works with simple requests.

The example above can also be referred to as a single thread. Typical web servers create a single thread for each request, but Nginx does not. As previously mentioned, Nginx operates an asynchronous, event-driven architecture. This indicates that the same or similar threads are managed under a single worker process, and that each worker process consists of smaller units called a worker connection. This whole unit is responsible for handling request threads. A worker connection sends a request to the worker process, which it also sends to the master process. The master process then displays the results of the request or request.

At first glance, how Nginx works looks easy, but you need to know that just one worker connection can handle up to 1024 of the same and similar requests. Because of this, Nginx can process thousands of requests without any difficulty. This ability has also led it to become a server that is often used by high-traffic websites, such as e-commerce, search engines, and cloud storage.

Nginx Features

Nginx can be deployed to serve dynamic HTTP content on the network using FastCGI, SCGI handlers for scripts, WSGI application servers or Phusion Passenger modules, and it can serve as a software load balancer.

Nginx uses an asynchronous event-driven approach, rather than threads, to handle requests. Nginx's modular event-driven architecture can provide more predictable performance under high loads.

Nginx default configuration file is nginx.conf.

HTTP proxy and Web server features:

  • Ability to handle more than 10,000 simultaneous connections with a low memory footprint (~2.5 MB per 10k inactive HTTP keep-alive connections)
  • Handling of static files, index files and auto-indexing
  • Reverse proxy with caching
  • Load balancingwith in-band health checks
  • TLS/SSL with SNI and OCSP stapling support, via OpenSSL
  • FastCGI, SCGI, uWSGI support with caching
  • gRPC support since March 2018, version 1.13.10.
  • Name- and IP address-based virtual servers
  • IPv6-compatible
  • WebSockets since 1.3.13, including acting as a reverse proxy and do load balancing of WebSocket applications.
  • HTTP/1.1 Upgrade (101 Switching Protocols), HTTP/2 protocol support
  • URL rewriting and redirection

Other features include upgrading executable and configuration without client connections loss, and a module-based architecture with both core and third-party module support.

The paid Plus product includes additional features such as advanced load balancing and access to an expanded suite of metrics for performance monitoring.

https://en.wikipedia.org/wiki/Nginx

Tags: