What is Nginx and how does it work?
Nginx is a web server that can also be used as a reverse proxy, load balancer and proxy for mail protocols.
In addition to other tasks, web servers are responsible for the delivery of web applications, responding to HTTPS requests made by users, usually from a web browser.
The nginx project, developed by Igor Sysoev, began to be distributed in 2004, focused on obtaining high concurrency and reduced memory usage.
It was created to solve the main performance limitations of Apache, for example the so-called c10k problem that occurs from 10,000 simultaneous connections to a website.
Nginx currently has 20% of the web server market share.
Its excellent performance in web projects with many simultaneous or concurrent visits when serving mostly static content, has led it to be the most used web server software today, coming out as the winner in performance comparisons with respect to other web servers.
How Nginx works?
The basic operation of Nginx is similar to other web servers, in which a user makes a request through the browser to the server, and the server sends the requested information to the browser.
What makes Nginx different is its architecture when handling processes, since other web servers such as Apache create a thread for each request.
That is, every time a user makes a request to the server, for example by logging into the web, a new thread will be created.
Nginx works in a more efficient way thanks to the asynchronous architecture based on events, in which instead of creating a thread for each request, it manages everything under the same work process where the different threads are managed.
This nginx thread or process contains several microprocesses or job calls. This results in a better performance of Nginx against Apache especially in memory consumption.
Nginx vs Apache
However, there are not all advantages in using nginx over Apache. Nginx for example does not support the .htaccess file for web application configurations. It would be necessary to make these modifications at the server level.
This implies that when using web applications such as WordPress it is necessary to make additional configurations on the server for proper operation.
To avoid this problem of compatibility of web applications with Nginx in Webempresa we use a combination of Nginx and Apache.
This allows us to take advantage of the speed of Nginx to serve static files and the compatibility of Apache with the main CMS.
How to know if my website uses Nginx
We have different tools to know if our website uses Nginx or not, such as Pingdom or the element inspector of your browser.
If you want to check who serves the different elements of your website you can use GTMetrix:
In Webempresa by default we use Apache as web server and Nginx as reverse proxy + Varnish (Magic Cache if your plan has it included) which, added to the rest of custom configurations of our servers, allow you to get an optimal loading speed for your web project.