NGINX — Better and Faster Web Server Technology

Shweta Datar
Javarevisited
Published in
4 min readAug 28, 2019
Nginx

Web servers are the backbone of any internet operations and deciding the right type of web server can be the difference between a successful app/website and a mediocre website that lags. So, it is important to understand your needs, before you decide which web server should you pick.

What is NGINX?

NGINX, pronounced as engine-X is a popular web server that also doubles as a reverse proxy, load balancer and HTTP cache for HTTP, TCP, and UDP servers. Designed by Igor Sysoev in 2004, this web server was designed as a way to bypass the C10k problem.

NGINX is an open software, but also offers a paid plan and currently runs on multiple environments including Unix, Linux, BSD variants, MacOS, Solaris, AIX, HP-UX, and Windows. Sysoev’s goal when creating this web server was to create the fastest web server around and the community consistently tries to continue maintaining this goal. It beats other web servers in benchmarks measuring web server performance.

As websites became more dynamic, NGINX has followed suit. From simple HTML pages to dynamic websites, NGINX supports all the components of the modern Web, including WebSocket, HTTP/2, and streaming of multiple video formats (HDS, HLS, RTMP, and others).

C10k Problem

When the internet was young, scaling wasn’t such a big issue. However, as the internet grew into a massive aid for business and connecting people across the web, scaling became one of the main issues that needed to be tackled.

The main problem that web servers commonly face were heavy loads, when more connections are required to be made, the web server slows down. This was coined as the C10k problem by Dan Kegel in 1999, referring to the Simtel FTP host, cdrom.com, serving 10,000 clients at once over 1 Gigabit Ethernet in that year.

Although, servers are more than equipped to handle that many loads today, the problem that many web servers still come across is that handling more request per second, which reduces the speed of handling requests. NGINX uses a more scalable event-driven (asynchronous) architecture, instead of relying on thread-based request handling system, making it efficient to handle more requests per second without compromising on speed.

Features of NGINX

  • Low memory footprint
  • Ability to handle more than 10,000 simultaneous connections
  • Handling of static files, index files and auto-indexing
  • Reverse proxy with caching
  • Load balancing
  • IPv6-compatible
  • Name-based and IP-based virtual servers
  • The PUT, DELETE, MKCOL, COPY, and MOVE methods
  • FLV and MP4 streaming
  • Response rate limiting
  • Limiting the number of simultaneous connections or requests coming from one address
  • Embedded Perl

These are just a few of the features of NGINX, you can check out a complete breakdown of its features here.

LEMP Stack

LEMP is an anagram that defines a group of software that are used to get a server up and running. The stack includes the following four software: Linux, NGINX (pronounced as engine-X) MySQL and PHP.

LEMP stack is a variation of the famous LAMP stack, but replaces Apache with the lightweight and powerful NGINX, keeping the rest of the stack intact.

Difference between LEMP and LAMP

As stated above, the only difference between the LAMP and LEMP stack is the web server. While, LAMP uses Apache web server software for its apps, LEMP uses NGINX for its own stack.

Apache has dominated the server technology for so long and has played a key role in the initial growth of the World Wide Web, but was slow and laggy, compared to NGINX and Varnish, when it came to delivery of static pages. However, in the 2.4 series Apache has managed to compete head to head with event-based web servers. You can learn about Apache basics in this tutorial.

Currently the LAMP stack is more popular when it comes to building websites. However, LEMP is following close behind for developers who want a web server that is fast and has a smaller footprint.

Apache vs NGINX

Apache and NGINX can be considered as two sides of coin, with both offering the same end objective with different means. Apache and NGINX are both fabulous software that can build powerful and dynamic websites.

Here are some features of each server technology:

Features

While both Apache and NGINX are amazing software for building web servers, Apache is more fit for functionality heavy apps and websites, while NGINX is faster and able to handle a higher load. NGINX also offers other functions such as reverse proxy, load balancer and HTTP cache, making a powerful software to have on hand.

If you want to master NGINX, you can start learning this amazing web server from scratch, including how to install, configure and set it up in this beginner’s tutorial.

--

--

Shweta Datar
Javarevisited

I’m passionate web designer. In addition with web designing I have knowledge of #SEO #SocialMedia. I like to read and write technology stuff.