A Short Guide to Nginx: Its Beginnings, What It Is and How It Works

Nginx official website

Nginx is an open-source software, functioning initially as a web server, but it’s also used as a reverse proxy, HTTP cache, or a load balancer. It’s been released under the terms of the 2-clause BSD license, and its event-driven architecture (EDA) brings about a more predictable performance.

The default configuration file of Nginx is nginx.conf.

The Story of Nginx

Nginx was created by Igor Vladimirovich Sysoev, a Russian software engineer, with the purpose of helping solve the C10k problem. The C10k problem refers to optimizing network sockets so that they can deal with more clients at the same time. This server inability to scale more than 10,000 clients all at once as a result of resource exhaustion is just the basic idea that lies behind Nginx. Yet, in the beginning, Nginx was running mostly on Russian websites such as Rambler, Yandex, and VK.

Throughout the years, Nginx has transformed and upgraded so greatly, even beyond everyone’s expectations. In fact, as almost every web server management system and the Internet as a whole have developed, Nginx and the likes followed suit.

Today, Nginx is a lightweight web server providing high-level performance perfectly suitable for high-traffic scenarios.

Nginx in Numbers

  • Nginx had its official release in October 2004;
  • Was supposed to only solve the C10k problem;
  • Emerged as a third most popular web server right alongside Microsoft ISS and Apache Web Server;
  • 15 years later it experiences slow, yet steady growth over the course of time;
  • There are 2 versions of Nginx: OSS Nginx and Nginx Plus;
  • In September 2017, Nginx announced an API management tool, the NGINX Controller;
  • In March 2019, 5F Networks acquired the Nginx company for $670 million;
  • On December 24, 2019, Nginx 1.17.7 mainline version was released;
  • As of January 2020, Nginx has:
  •  24,713 followers on Linkedin;
  • 15,086 followers on Facebook;
  • 77,6K followers on Twitter;
  • Its headquarters are in San Francisco, California (founded in 2011);
  • Company size (201-500 employees);
  • SIC (Standard Industrial Classification) code: 7372;
  • 40903 companies use Nginx; 
  • Nginx is used by 31.3% of all the websites whose web server we’re familiar with.

How Does Nginx Work and What Are Its Features?

As the purpose behind creating Nginx was to design one of the fastest web servers, this remained as a central point around which the whole continuing development of Nginx revolves.

Nginx is designed to provide low memory usage, and it makes use of an asynchronous event-driven approach to handle requests (instead of threads). So, using Nginx means one master process is capable of controlling several worker processes (the workers doing the actual processing).

Without any doubts, Nginx set the standards for what it means to provide websites with scalability, high-performance, and mature software. Although after its initial release its function was to mainly server static content, nowadays the situation is different.

Today Nginx’s function and purpose go far beyond web serving – as Nginx can handle a high number of connections, Nginx is frequently used as a reverse proxy as well as a load balancer. This also assists with increased incoming traffic and Nginx manages it by distributing the traffic to slower servers.

There are many advantages to using software-based load balancing: they drastically lower costs; they make deployment fairly easy (this feature is especially evident in Nginx Plus); and they offer fast response time (no need for special installation or configuration).

These are only some of the many features that Nginx and the likes use in their software-based infrastructure. The benefits of such advanced software mechanisms far outweigh older hardware-based ADCs (Application Delivery Controllers).

However, it’s also important to denote that Nginx is constantly working on further upgrading its already existing features, as well as incorporating new ones. For example, Nginx Plus is tirelessly working on providing smooth application delivery.

Below we’ll outline additional Nginx features we consider relevant and significant.

Nginx Features

Nginx has a complex, yet highly functional and developed structure

HTTP server features:

  • Serves both index and static files;
  • Provides autoindexing;
  • SSL and TLS SNI support;
  • Modular event-driven (EDA) architecture;
  • A/B testing;
  • Redirection of 3xx-5xx error codes;
  • PUT, DELETE, MKCOL, COPY and MOVE methods;
  • MP4 streaming;
  • Both name-based and IP-based virtual servers;
  • Validation of HTTP referer;
  • URL rewriting.

Mail Proxy Server Features

Authentication methods:

  • POP3: USER/PASS, APOP, AUTH LOGIN/PLAIN/CRAM-MD5;
  • IMAP: LOGIN, AUTH LOGIN/PLAIN/CRAM-MD5;
  • SMTP: AUTH LOGIN/PLAIN/CRAM-MD5.

TCP/UDP proxy server features

  • A/B testing;
  • njs scripting language to extend Nginx functionality;
  • Load balancing;
  • IP-based geolocation;
  • Fault tolerance.

Scalability and Architecture

  • Adaptable configuration;
  • Supports epoll features (EPOLLRDHUP (Linux 2.6.17+, glibc 2.8+) and EPOLLEXCLUSIVE (Linux 4.5+, glibc 2.24+);
  • Supports kqueue features (EV_CLEAR, EV_DISABLE (to temporarily disable events), NOTE_LOWAT, EV_EOF);
  • Keeps data copy operations at the lowest level.

Tested OS and platforms

  • FreeBSD 3 — 12 / i386; FreeBSD 5 — 12 / amd64; FreeBSD 11 / ppc; FreeBSD 12 / ppc64;
  • Linux 2.2 — 4 / i386; Linux 2.6 — 5 / amd64; Linux 3 — 4 / armv6l, armv7l, aarch64, ppc64le;
  • Solaris 9 / i386, sun4u; Solaris 10 / i386, amd64, sun4v; Solaris 11 / x86;
  • AIX 7.1 / powerpc;
  • HP-UX 11.31 / ia64;
  • macOS / ppc, i386, x86_64;
  • Windows XP, Windows Server 2003, Windows 7, Windows 10.

Nginx Users

Nginx has a wide range of users and its numbers are constantly increasing

We already mentioned that when Nginx appeared it was with the sole aim to help solve the C10k problem. And we also made a reference to several heavily loaded Russian websites using it.

However, much later the situation with Nginx and its function changed so profoundly that there is basically no correlation between its original purpose and its usage today.

Now Nginx is perfectly suitable for the modern IT structure with its software-based load balancing role and in general its multifunctionality.

To fully illustrate how much popularity Nginx enjoys today, we listed some of the most famous brands that use it. Please note that this is by no means a complete list (in the section “Nginx in Numbers” we’ve stated that there are 40903 companies using Nginx, so we won’t be able to mention all of them out of obvious reasons).

Here’s the list with some of them:

  • Adobe
  • AppNexus
  • Groupon
  • University of Texas
  • Wix
  • WordPress.com
  • 3BetGaming
  • BuzzFeed
  • CloudFare

Nginx Rivals

Owen Garett, an Nginx project manager, stated: “Nginx was written specifically to address the performance limitations of Apache web servers.” And this is noticeable more and more over the course of time because it seems that Nginx, with its more advanced software and scalability, slowly outperforms Apache.

It’s been claimed that Nginx has the capacity to serve at least 10x (sometimes even 100-1000x more!) requests per server in comparison to Apache’s capacity. This is what makes Nginx great for busy websites (e.g. eCommerce). Also, Nginx’s complex, event-driven architecture is much different from that of Apache.

In fact, it’s estimated that Nginx is expected to overtake Apache at some point in late 2020. Take a look at the following stats:

Nginx is responsible for powering:

  • 60.9% of the 100,000 most popular sites;
  • 67.1% of the 10,000 most popular sites;
  • 62,1% of the 1,000 most popular sites.

Apache powers:

  • 24.0% of the 100,000 most popular sites;
  • 18,8% of the 10,000 most popular sites;
  • 16,6% of the 1,000 most popular sites.

Nginx is predicted to continue growing and potentially surpass Apache

However, even if Nginx does end up outranking Apache, these web servers aren’t the only ones out there. They both have many competitors and people may opt for a third option. This ultimately depends on what your website needs, how much you’re willing to pay, as well as how much you’re willing to invest in the long-run.

So, here’s a list of alternatives (also competitors) to Nginx besides Apache:

  • HAProxy
  • OpenResty
  • Microsoft IIS
  • lighttpd
  • LiteSpeed
  • Caddy
  • Envoy

A Few Final Words On Nginx

Nginx is expected to continue evolving

Nginx’s multifunctionality truly makes it a worthy investment. Being able to use the same tool as your reverse proxy, web server, and load balancer truly bears witness to the ongoing evolution Nginx undergoes. Plus, having such a tool with the properties Nginx offers minimizes the overall configuration you need in order to maintain it.

And this doesn’t end here because Nginx has no plan whatsoever on taking a break or to stop keeping up with all the latest web development.

The only question is whether YOU are capable of keeping up with it?

View Related Articles

What Is an Inode?

In a real-world filing system, there needs to be a record of where each file is. Otherwise, there really wouldn’t be a point in having a filing system. An inode is a concept that solves this problem digitally, in Unix filing systems.

Leave a Comment

Your email address will not be published. Required fields are marked *