Which web server should you use – Apache or NGINX?

Should you use Apache or NGINX as your web server? Jack Wallen helps answer this question.

What web server are you using and why? Chances are you’re using one of three: Microsoft IIS, Apache, or NGINX. If you’re using IIS, it’s probably because your data center is full of Microsoft servers. If you’re using Apache or NGINX, this question gets a bit fuzzy. Let me help you decide which open source web server to use.

The decision really comes down to design. Apache is a process-driven design, while NGINX is an event-driven design. What does this mean in the real world? Simple. Apache does a great job of handling a large number of requests per second. However, the performance of an Apache site often slows down as these requests increase. When an Apache-driven website suddenly increases, page load times suffer. Why? Because Apache creates a new process for each new request. It is a very reliable model that works well for low traffic applications. However, when this traffic increases, the demand for resources results in slower performance.

NGINX, on the other hand, is optimized to deliver consistent and predictable performance. So when your web server is under heavy load, NGINX does not flicker. This is due to the different design patterns – event versus process. Since NGINX is an event-based framework, it can process about four times as many requests per second.

But don’t think you should just use NGINX because it can outperform Apache. Remember that Apache has been around for a very long time, so there are plenty of third-party resources and add-ons available. And if you’re looking to serve dynamic content, Apache’s built-in ability to parse and run many types of scripting languages ​​makes it truly flexible.

To sum up: if performance is your goal, NGINX is your tool. If you want flexibility, go with Apache.

Also see


Image: Jack Wallen

Comments are closed.