July 10 2019

Apache VS NGINX. What is the best web server?

The eternal dilemma between the two webserver protagonists of the network.

Apache and NGINX are the two most popular open source web servers today. However, deciding the best of the best of the best can be a difficult task. So to make things easier for you, we will compare Apache vs Nginx in detail.

We hope this post on Apache vs Nginx will help you make the right choice for your online business.

But before we go any further, let's go through a brief introduction of both web servers.

Apache HTTP Server

Apache HTTP Server is a cross-platform open source web server which is also sometimes referred to as “httpd” and Apache.

Here are some important points about Apache:

Since 1999, the Apache Software Foundation has managed the brand and its services.
The server is developed and maintained by an open community of developers under the aegis of the foundation.
Mostly running on Linux, Apache powers over half of all websites worldwide.
By far, it is one of the most popular web servers today, which is the component of the popular LAMP stack (Linux, Apache, MySQL, PHP).

NGINX Web Server

What is NGINX? Pronounced as “Engine X” - it is a web server that was released in 2004 by Igor Sysoev. Today, it is much more than just a web server!

Here's what you should know about the Nginx server:

In the beginning, people mainly used Nginx as an Apache supplement.
It was used primarily to serve static files, but today it has evolved as a full-featured web server that takes care of the full range of server tasks.
Today, Nginx is often used as a reverse proxy, load balancer, mail proxy, and for HTTP caching.
Both Apache and Nginx are the most common web servers for Linux. Together, they serve more than 50% of the traffic on the web.

PS While Apache and Nginx share many features, their strengths and qualities are different in many areas. Each excels in its own way and has its own uses and scenarios.

To know the differences and come to a conclusion, let's look at the detailed and complete comparison that follows. We also mentioned the winner of each comparison point at the end of each point.

Apache vs NGINX - Let the battle begin!

We are comparing the two best web servers based on these 9 criteria. All features are critical, so be very careful.

  1. Architecture
  2. Performances
  3. OS support
  4. Configuration
  5. Interpretation
  6. Forms
  7. Flexibility
  8. The security
  9. Support and support
  10. Conclusion

1. Basic architecture

When it comes to Apache vs Nginx, the key difference lies in their design architecture. It means they differ in how they handle links and traffic and respond to different traffic conditions.

One implies a process-oriented approach and the other follows an event-oriented architecture.


  • Process-driven approach
  • Create a new thread for each request.

Apache follows a multi-threaded approach. Provides a variety of multiple processing modules. These pre-modules are basically of three types of request handling algorithm. Each of them is designed for different server needs.

MPMs (Multi-Processing Modules) provide a flexible architecture for the choice of different connections and different management algorithms.

Additionally, different versions of Apache 2 use different procession modules.

The three main Apache MPMs are:

  • Process (prefork) MPM
  • Worker MPM
  • Event MPM

Old school Apache (2.2) uses mpm_worker, mpm_prefork and mod_php.

While Apache 2.4 (new apache) is configured to use mpm_event, php-fpm.

By default, Apache 2.2 is configured in Pre-fork mode (mpm_prefork). Responds to a number of processes, each of which can serve a single request at a time.

In other words, Apache creates a new thread every time to handle every connection request.

Thread: A thread is the smallest sequence of programmed instructions that can be handled autonomously by a scheduler. In most cases, a thread is a component of a process.

However, the core architecture of Apache can lead to heavy resource consumption, therefore, it can cause problems with the server (slow speed).


  • Event-oriented approach
  • Handles multiple requests within a single thread

Nginx uses an event architecture and handles requests asynchronously.

It is designed to use a non-blocking event connection management algorithm. Thus, its process can handle thousands of connections (requests) within a single processing thread. Such connection process modules allow Nginx to work very fast and broadly with limited resources.

Additionally, it is possible to use Nginx on low power systems, and with systems operating under heavy loads.


NGiNX - It has a lightweight structure and a much faster architecture than Apache.

2. Performance

Taking Apache vs Nginx, both web servers process static and dynamic content differently. They say Nginx is better when it comes to processing static content, let's see if that's true!

2.1 Static Content



Serves static content using the file-based method
Static content or files are typically files stored on disk on the server computer, for example, CSS files, JavaScript files, or images. Apache handles static content using the conventional file-based method.


When serving static content, Nginx is king!
Since Nginx's design architecture is better equipped to handle the load, it's much faster when it comes to serving static content.

It performs 2,5x faster than Apache according to a benchmark test running up to 1.000 concurrent connections.

Nginx serves the static resources without PHP having to know. On the other hand, Apache handles all those requests with that expensive overhead. This makes Nginx more effective and less demanding on system resources.

This small image shows the number of static content requests processed per second. Nginx clearly outperforms Apache here!

2.2 Dynamic Content



  • Process dynamic content within the server

Apache is able to process dynamic content within the web server itself without having to rely on external components.

Speaking of Apache vs Nginx Performance: Nginx, if not better, is about the same when it comes to dynamic content processing.

Here is the comparison of dynamic content request numbers per second. There seems to be little difference.


It does not process dynamic content
Speaking of dynamic content, Nginx cannot process it within the web server like Apache does. All requests with dynamic web page content are passed to an external process (eg-PHP-FPM) for execution.

Nginx waits for the final content to return and returns it to the customer. Refer to this image to get a clear idea:

NGINX can serve dynamic content when used with SCGI handlers and the FastCGI module.

PS This process seems a bit complicated. However, it works somewhat in its favor and makes Nginx faster.


Static: When it comes to static content, Nginx outperforms Apache.

Dynamic: Both are great at processing dynamic content.

3. OS support

Operating system support can be an important point to consider, especially when comparing Apache and Nginx. But, both of them are almost similar here.


  • It supports all Unix-like systems, including Linux and BSD.
  • Fully supports MS Windows

Apache works on all types of Unix-like systems (for example, Linux or BSD) and has full support for Microsoft Windows.


  • It supports almost all Unix-like OS operating systems
  • Partially supports Windows.

It also runs on several modern Unix-like systems and has some Windows support, but its Windows performance isn't as strong as that of other platforms.


Apache comes out winner here.

4. Distributed / centralized configuration

Apache vs Nginx is a well-deserved argument. Their configuration makes them different from each other and makes them equally interesting. Let's see who has an easier and faster setup.


  • Allows additional configuration for each directory via .htaccess file.

This architecture allows non-privileged users to control certain aspects of their website without granting them permission to modify the main configuration. This is a big thing!


  • It does not allow additional configurations

It, on the other hand, has a downside. It does not provide additional configuration. However, it works in your favor as this boosts performance.
By not allowing directory configuration, it can serve requests faster than Apache. It does not need to search for .htaccess files and interpret user requests.


Apache when considering the configuration; NGiNX when considering speed.

5. Interpretation Request

In the debate between Apache and Nginx, the request interpretation method is an interesting topic of comparison. They both process and interpret requests completely differently.

Their different methods make them unique and make one a little better than the other. Let's explore how!


  • Steps Location of the file system

Provides the ability to interpret requests. As a physical resource on the file system path it may require more abstract evaluation. Pass requests as file system locations.

Of course, Apache uses URI positions, but they are generally for more abstract resources. And while creating or configuring a virtual host, Apache uses directory blocks under the document root.

This preference for file system locations can also be seen in using .htaccess files to override specific directory configurations.


  • Pass URI to interpret requests

Nginx was created to be both a web server and a reverse proxy server. Due to the architectural demand.

It does not provide a mechanism for specifying the configuration. For the file system directory, it passes their own URI instead. Passing requests as URIs instead of file system locations allows Nginx to work easily on both the web and the proxy server. Configure in a simple way, defining how to respond to the different request models.

It does not check the file system until it is ready to serve the request and explains why it does not implement any form of .htaccess file.

This same design of interpreting requests as URI positions allows Nginx to easily function not only as a web server but also as a proxy server, load balancer and HTTP cache.

Also, in the Apache vs Nginx challenge, NGINX wins once again when it comes to the transfer rate (the speed at which data was sent from the server to the client). And in most cases, Nginx wins by a fair amount for 500/100.


It looks like Nginx won thanks to its faster interpretation and response.

6. Functional modules

Both are extensible through modular systems. But the way they work is different. Let's compare the feature modules of both web servers: Apache vs Nginx!


  • 60 dynamically loadable official modules that can be turned on / off

The Apache server has a rich set of features that can be activated by installing one of the 60 official modules. There are also many other unofficial modules that can be found easily on the internet.

Its module system allows you to dynamically load or unload modules to suit your needs. Its modules can be activated or deactivated to add or remove functionality and to connect to the main server.

In short, Apache has several functional modules to suit your needs, but many of them aren't used often.


  • Central third-party modules (not dynamically loadable)

Nginx, on the other hand, is selected and compiled over third party plugins. Not dynamically loadable. Forms are useful, however, they allow you to dictate what you want from your server by including only the features you intend to use.

It is considered much more secure than the Apache server as arbitrary components can be docked to the server.

Plus, NGINX provides all the key features of a web server, without sacrificing the lightweight, high-performance qualities that made it a winner.

Note: Apache is like Microsoft Word and Nginx is like Notepad. Like? Apache has a million options, but only a few are needed. NGINX does these 'few' things and does them 50 times faster than Apache.


NGiNX - Its less important features and modules make it lighter, smarter and better than Apache web server.

7. Flexibility

Flexibility is one of the most important concerns when it comes to a web server. The flexibility between Apache and Nginx has some interesting differences.


  • It supports the customization of the web server through dynamic forms.

Customizations to the web server can be done through riding modules. Apache has had dynamic module loading for the longest time, so all Apache modules support it.


  • Not flexible enough to support dynamic forms and loading.

This, however, is not the case with NGINX. In early 2016, NGINX got support for dynamic module loading; previously, NGINX required the administrator to fill out the modules in the NGINX binary.

Most modules don't yet support dynamic loading, but over time they probably will.


Apache - He is clearly advanced on this point.

8. Security

Apache vs Nginx security is again a hot topic. Well, both of these web servers offer great extended security for its C-based code base.

So, users, relax!


  • Great security.

Apache makes sure that any website running on its server is safe from any harm and hackers.

It offers configuration suggestions for DDoS attack management and the mod_evasive module to respond to DoS, DDoS, or brute force HTTP attacks.


  • Better security with a smaller codebase.

The NGINX codebase, however, is significantly smaller by several orders of magnitude, which is certainly a big plus from a forward-looking security perspective.


Nginx - It is considered safer, although it is correct and absolutely clear that the intrinsic security of two web servers can be comparable.

9. Support

Service is something that every customer is very interested in. It can make or break your user experience. While comparing Apache vs Nginx support, there doesn't seem to be a big difference.


  • Community support is provided through mailing lists, IRC and Stack Overflow.

Commercial Apache support is available from a number of third-party companies, such as OpenLogic, but no official lists are maintained by the Apache Foundation. The Apache server is meant to offer great support to all its users.


  • Community support through mailing lists, IRC, Stack Overflow and a forum.

The company behind NGINX offers a commercial product called NGINX Plus, which supports a number of additional functions in regards to load balancing, media streaming and monitoring.


Draw and tie! The support is almost the same in both.

Some necessary considerations

Both Apache and Nginx cannot be replaced by each other, they have their own strengths and weaknesses. And after getting over the benefits, limitations and differences, you may already have an idea of ​​the best web server for you.

Well, in our post on Apache vs Nginx, 5 out of 9 points were won by NGINX, 2 points went to Apache, and 2 points were 'even' between Apache and Nginx. Hence, we can clearly see that NGINX has an advantage over Apache.

Still confused about which server is best for you? Let's find out when to choose which one!

When to choose Apache over NGINX?

i) Apache .htaccess

NGINX doesn't support something like Apache's .htaccess file. However, with Apache, you have the advantage of giving unprivileged users control over some important aspects of their website.

Users, of course, are not allowed to change the main configuration.
By using the .htaccess files, you can override the system settings for each directory.
For best performance, include these .htaccess directives in the main configuration files.
In a shared hosting environment, Apache works best due to its .htaccess configuration.
PS For dedicated hosting or VPS Nginx remains the best option.

ii) In case of functionality limitations - use Apache

Nginx has some basic modules which are very important. However, there are some functionality limitations with Nginx.

If you have limitations or need to use extra modules that are not supported by Nginx, you may want to choose Apache.

When choosing NGINX over Apache?

i) Fast and static content processing

Nginx can do a better job of handling static files from a specific directory.

Furthermore, the upstream server processes are not blocked due to heavy and multiple requests for static content, as Nginx can process them simultaneously. This significantly improves the overall performance of the backend servers.

Nginx is relentlessly trying to serve its users a better experience. It showed remarkable growth in 2018. Take a look at the top 2018 earnings on the Nginx blog.

ii) Great for high traffic websites

When it comes to speed and how many customers can be served with a high load, Nginx will always be a winner over Apache.

This makes Nginx significantly lightweight and large for server resources. This is why most web developers prefer Nginx to Apache.

In particular, e-stores today hire a Magento developer who knows how to work on a high traffic website, and who is skilled at working on Nginx.

Simply put, when it comes to serving a website with a large volume of traffic, it doesn't get any better than Nginx.

Or, use both together!

Yes, Apache and Nginx can be friends too!

It is possible to use the strengths of each server by using them together.

You can use Nginx in front of Apache as a proxy server (as shown in the image below). This takes advantage of Nginx's fast processing speed and the ability to establish a big no, connection at the same time.

For static connections, Nginx will quickly serve the files to clients. For dynamic content, for example, Php files, the Nginx reverse proxy server will send their request to Apache which can then process their results and return the rendered page.

Nginx can then pass the final content to the client. Furthermore, it allows you to have a very functional web server to serve your customers (the large volume of users) very quickly.

In conclusion:

Deciding which web server to use, Nginx or Apache, is an important step in setting up your website.

Both solutions are capable of handling different workloads and working with other software to provide a complete web stack.

We hope this end-to-end comparison guide helped you choose the best web server.

Do you want to have some more advice? Get in touch with us!

Do you have doubts? Don't know where to start? Contact us!

We have all the answers to your questions to help you make the right choice.

Chat with us

Chat directly with our presales support.


Contact us by phone during office hours 9:30 - 19:30

Contact us online

Open a request directly in the contact area.


Managed Server Srl is a leading Italian player in providing advanced GNU/Linux system solutions oriented towards high performance. With a low-cost and predictable subscription model, we ensure that our customers have access to advanced technologies in hosting, dedicated servers and cloud services. In addition to this, we offer systems consultancy on Linux systems and specialized maintenance in DBMS, IT Security, Cloud and much more. We stand out for our expertise in hosting leading Open Source CMS such as WordPress, WooCommerce, Drupal, Prestashop, Joomla, OpenCart and Magento, supported by a high-level support and consultancy service suitable for Public Administration, SMEs and any size.

Red Hat, Inc. owns the rights to Red Hat®, RHEL®, RedHat Linux®, and CentOS®; AlmaLinux™ is a trademark of AlmaLinux OS Foundation; Rocky Linux® is a registered trademark of the Rocky Linux Foundation; SUSE® is a registered trademark of SUSE LLC; Canonical Ltd. owns the rights to Ubuntu®; Software in the Public Interest, Inc. holds the rights to Debian®; Linus Torvalds holds the rights to Linux®; FreeBSD® is a registered trademark of The FreeBSD Foundation; NetBSD® is a registered trademark of The NetBSD Foundation; OpenBSD® is a registered trademark of Theo de Raadt. Oracle Corporation owns the rights to Oracle®, MySQL®, and MyRocks®; Percona® is a registered trademark of Percona LLC; MariaDB® is a registered trademark of MariaDB Corporation Ab; REDIS® is a registered trademark of Redis Labs Ltd. F5 Networks, Inc. owns the rights to NGINX® and NGINX Plus®; Varnish® is a registered trademark of Varnish Software AB. Adobe Inc. holds the rights to Magento®; PrestaShop® is a registered trademark of PrestaShop SA; OpenCart® is a registered trademark of OpenCart Limited. Automattic Inc. owns the rights to WordPress®, WooCommerce®, and JetPack®; Open Source Matters, Inc. owns the rights to Joomla®; Dries Buytaert holds the rights to Drupal®. Amazon Web Services, Inc. holds the rights to AWS®; Google LLC holds the rights to Google Cloud™ and Chrome™; Microsoft Corporation holds the rights to Microsoft®, Azure®, and Internet Explorer®; Mozilla Foundation owns the rights to Firefox®. Apache® is a registered trademark of The Apache Software Foundation; PHP® is a registered trademark of the PHP Group. CloudFlare® is a registered trademark of Cloudflare, Inc.; NETSCOUT® is a registered trademark of NETSCOUT Systems Inc.; ElasticSearch®, LogStash®, and Kibana® are registered trademarks of Elastic NV Hetzner Online GmbH owns the rights to Hetzner®; OVHcloud is a registered trademark of OVH Groupe SAS; cPanel®, LLC owns the rights to cPanel®; Plesk® is a registered trademark of Plesk International GmbH; Facebook, Inc. owns the rights to Facebook®. This site is not affiliated, sponsored or otherwise associated with any of the entities mentioned above and does not represent any of these entities in any way. All rights to the brands and product names mentioned are the property of their respective copyright holders. Any other trademarks mentioned belong to their registrants. MANAGED SERVER® is a trademark registered at European level by MANAGED SERVER SRL, Via Enzo Ferrari, 9, 62012 Civitanova Marche (MC), Italy.

Back to top