According to a statistic from W3Tech, Apache is the most popularly used webserver in 2016, occupying a market share of over 50% of all website operators. If, however, a different view of these numbers is taken and only the top 10,000 most visited websites are taken into account, then an al­tern­at­ive picture is painted: only about 30% of these sites make use of the server tech­no­logy from 1995. And of the top 1,000 commonly used servers, this number shrinks to just 27%. This figure can be partly explained by the dis­pro­por­tion­ately high amount of Google web servers (roughly 10%) in operation on which all Google pages run. Another reason, however, can be at­trib­uted to the rapid rise of the Russian web server, NGINX. Just as recently as 2010, NGINX was just one of the many Apache al­tern­at­ives, with a market share hovering around a meagre 4%. Nowadays, the BSD-licensed software is currently being used with every other web project in the top 10,000 and 1,000 re­spect­ively.

What is NGINX?

Russian software engineer, Igor Sysoev, is the main brain behind the 2004 release of the server software. As is the case today, back then, the main focus was to develop an ex­cep­tion­ally high-per­form­ing server that’s able to serve as many clients as possible without using too many resources. Due to the growing pop­ular­ity of the server, Sysoev started NGINX Inc. in 2011, which has since been re­spons­ible for con­tinu­ing the software’s de­vel­op­ment. And in addition to the free-of-charge standard version, the company also offers NGINX plus, a fee-based option with support and ad­di­tion­al features, such as improved load balancing.

Like Apache, NGINX is modularly built. This means that its many different functions are available through cor­res­pond­ing modules, which ad­min­is­trat­ors are able to activate or de­ac­tiv­ate. Here’s a list of some features that you’ll have access to:

  • Ap­plic­a­tion Ac­cel­er­a­tion: enables content to be more quickly displayed
  • Reverse proxying: allows NGINX to be used as a reverse proxy (HTTP, TCP, UDP) for web ac­cel­er­a­tion purposes or as an e-mail proxy (MAP, POP3, SMTP)
  • TLS en­cryp­tion: enables secure data transfer
  • Bandwidth man­age­ment: provides all services with optimal band­widths
  • Load balancing: relieves the man server by re­dir­ect­ing requests
  • Video streaming that offers high op­er­a­tion­al per­form­ance when streaming MP4 and FLV media.

While Apache opens a new thread or process for every client request, NGINX servers operate in an event-oriented manner. This allows requests to be asyn­chron­ously processed, which saves both working memory as well as time. The server software is also supported by a range of operating systems, including numerous Unix/Linux variants, including Mac OS and Windows servers.

In­stalling and con­fig­ur­ing NGINX

Those who’ve opted for the plus addition are walked through the in­stall­a­tion process through the NGINX support. Generally, however, in­stall­a­tion is carried out according to the notorious patterns of the packet manager, as most Linux dis­trib­uters include the NGINX packet in their re­pos­it­ory by default. In case the packet’s missing, its source code can be quickly and easily down­loaded from NGINX’s official website [NGINX’s official website] (https://www.nginx.com/products/download-oss/). In the following steps, we’ll show you how the web server is installed and con­figured under Linux.

1. With the following command, update the packet manager so that your system then reverts to the newest version of the NGINX packet upon in­stall­a­tion:

sudo apt-get update
sudo apt-get install nginx

2. NGINX generally starts right after step one. In order to check whether or not the software is func­tion­ing properly, just call up the NGINX landing page via the server’s domain name or the public IP address in your browser. You should receive the following message after a suc­cess­ful in­stall­a­tion:

3. Everything that’s needed for con­fig­ur­ing NGINX can be found in the directory, /etc/nginx or also in the central con­fig­ur­a­tion file, nginx.conf. Whenever you end up making changes to this file, you’ll need to restart the server with one of the two following commands in order for these changes to be accepted:

sudo service nginx reload
sudo service nginx restart

With the para­met­ers, start and/or stop, users can com­pletely turn off the service and start it back up again.

4. The con­fig­ur­a­tion file’s syntax has the following char­ac­ter­ist­ics:

  • Settings: all settings begin with a cor­res­pond­ing variable name. Using a blank space, one or multiple arguments can be added — these end with semi­colons.
worker_connections 768;
  • Primary settings: some settings, like the events variable, contain arguments that can then represent settings with their own arguments. These sub-in­struc­tions contain curly brackets ({}).
events {
    worker_connections 768;
    multi_accept on;
}
  • Hashtag (#): these are in­struc­tions that have been de­ac­tiv­ated are commented out with a hashtag. Removing this symbol activates the settings again. So in the case of the following con­fig­ur­a­tion…
# multi_accept on;

the option to accept multiple clients sim­ul­tan­eously has been de­ac­tiv­ated.

  • Tab stops and multiple spaces: NGINX in­ter­prets set tabs and re­peatedly set spaces as one single space.  When con­fig­ur­ing NGINX, you can make use of this aspect to ensure that the con­fig­ur­a­tion file is both easily readable and struc­tured.

5. Further in­form­a­tion on in­di­vidu­al modules as well as NGINX tutorials for setting up web or proxy servers based the server software can be found within the following documents from the provider.

What makes NGINX so popular

There are many reasons for NGINX’s in­creas­ing pop­ular­ity. First of all, the web server software is in tune with the current re­quire­ments of many web projects. This is due to the fact that NGINX doesn’t only reach first-class results when pro­cessing large numbers of client requests; it also functions in an extremely efficient manner, making the software the perfect answer to the limited per­form­ance of many mobile data con­nec­tions. As a website operator, NGINX supports you by quickly de­liv­er­ing content to all users, including those on mobile devices. What’s more, the open source product from the Russian de­vel­op­ment team has won over many users with the flex­ib­il­ity that the software offers. In addition to its classic HTTP web server option, NGINX also delivers a con­vin­cing per­form­ance when it comes to reverse proxying tasks (e.g. as an e-mail proxy server or a load balancer). Despite all these strengths, NGINX isn’t the be-all-end-all for server solutions: shared hosting that’s con­trolled via password-protected areas or internal redirects proves quite difficult to set up. Such sections and rewrites can only be created in the central con­fig­ur­a­tion file and im­ple­men­ted by re­start­ing the server. Following this, any occurring errors affect all par­ti­cipants of a shared-hosting instance. This is where Apache still comes in handy, as in­di­vidu­al settings in separate .htaccess files can be recorded.

Go to Main Menu