NGINX: how does this web server work?
NGINX, a little history
NGINX is therefore a web server, with the particularity of being open source. While its primary objective is to allow the server to execute http requests, over the course of its existence, many other uses have been developed. As a result, it is currently used both as a reverse proxy and as a load balancer, a tool that allows traffic to be distributed only on healthy servers within a web infrastructure.
The origins of NGINX dates back to 2004. It’s creator is Igor Sysoev. Initially, he designed NGINX to solve a management problem: at the time, servers were not powerful enough to receive 10,000 simultaneous connections. So, how does NGINX work? We’re going to find out why now.
NGINX: how does it work?
Before taking a closer look at how NGINX works, let's look at its various features. It includes an inverted proxy with caching, network protocol without IPv6 connection, the network protocol of the Socket application layer, Fast CGI support with caching, the management of several types of files (static or index), as well as automatic indexing and finally, and the protocols for securing TLS/SSL exchanges, with SNI. As mentioned above, NGINX is able to act as a load balancer as well.
How NGINX works
The particularity of NGINX lies in the low memory usage it facilitates. On the other hand, unlike other web servers, this one works asynchronously. In practice, the processing of requests is organised as follows: a master process receives these requests and distributes them so that they can be processed by workers. As a result, thanks to this type of operation, all requests can be supported simultaneously, since the whole thing is managed in a single thread.
Apache and NGINX: what are the differences?
Among the most commonly used web servers at the moment, we can, of course, point to NGINX, but also to Apache . What are the differences between these two pieces of software? How do you make the right choice? Let’s explain.
What is Apache?
Apache is the number one server on the Internet. Today, it is available in the EasyPHP package and comes with the MySQL database server, the PHP application server, and the phpMyAdmin tool.
Its relatively long and laborious development has made it particularly reliable and not very vulnerable. However, vulnerabilities may still be detected. When this is the case, an update is quickly implemented.
Due to its many years of existence, the Apache web server is equipped with a wide range of features to meet users' needs.
Apache is used by 47% of all the sites on the web. However, it is evident that NGINX is the solution requested for platforms with a large number resources as well as a high level of traffic. This is the case, for example, with Netflix or CMS WordPress. Indeed, NGINX is becoming more and more popular, to the detriment of Apache. Moreover, since 2004, this particular search term has been in free fall.
The question that then arises: should NGINX be preferred to Apache? That’s what we’re going to find out now.
The differences between these two web servers
- The software mode: while Apache and NGINX are both open source web servers, NGINX is also available in a paid version, with more features.
- The performances: it is difficult to differentiate between the two pieces of software in this regard. Indeed, NGINX is the product of a modern design, operating on the principle of asynchronism. For its part, Apache has been in existence for more than two decades and continues to improve over time, thanks to ever more advanced modifications. As a result, it is considered that the two web servers are equal in terms of performance and efficiency.
- Modularity: to assess this criterion, several points must be taken into account. This relates, in particular, to the simplicity of installation, development and resolution of vulnerabilities. Apache is definitely the most modular web server, since it is possible to customise it as desired, thanks to the addition or removal of modules by a simple enable/disable command. However, NGINX does not offer this feature. As a result, to add or remove a module, the user will have to recompile the software, a relatively tedious and more expensive process.
Apache or NGINX: which to choose?
Apache and NGINX are two high-performing and efficient web servers. However, in order to choose the right one for you, it is essential to take stock of your needs. We recommend NGINX to all users looking for a reverse proxy or mail service with simple functionalities for a well-framed project with minimal development needs.
On the other hand, in the case of a project requiring many configurations, subject to more or less significant development and involving the management of many requests it is preferable to turn to Apache ...
It is therefore through evaluating your specific needs that you will be able to choose the best web server. So, how to know which is being used? That’s what we’re going to find out now.
How can you know which server you are using?
It is easy to know which web server is being used. To do this, it is essential to use a tool such as GTmetrix. However, Chrome Devtools also offers this. This information can be found in the PHP server header.