Apache and NGINX are the two most popular open source web servers today. However, deciding the best out of the bests can be a tough task. So, to make it easy for you, we’re going to 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 moving further, let’s go through a short intro of both web servers.

Quick Intro on Apache and NGINX

Apache HTTP Server

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

Here are some major points about Apache:

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

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 a lot more that just a web server!

Here’s what you should know about Nginx server:

  • At first, people mostly used Nginx as an Apache supplement.
  • It was used mostly for serving static files, but today, it has evolved as a complete web server that deals with the full spectrum 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 server for Linux. Together, they serve more than 50% of traffic on the web.

P.S. While Apache and Nginx share many qualities, they are different in many areas. Each excels in its own way and has its own uses and scenarios.

To know the differences and reach out to a conclusion, let’s go through the detailed, end-to-end comparison below. We have also mentioned the winner of each point of comparison at the end of each point.

Apache Vs NGINX – Let the Battle Begin!

We’re comparing the two best web servers on the basis of these 9 criteria. All the features are critical so pay close attention.

1. Basic Architecture

When it comes to Apache vs Nginx, the fundamental difference lies in their design architecture. It means they differ in the actual way they handle connections and traffic and respond to different traffic conditions.

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


  • Process Driven Approach 
  • Creates a new thread for each request.

Apache follows a multi-threaded approach. It provides a variety of multiple processing modules. These pre-modules are basically of three types of requests handling algorithm. Each is meant for different server-needs.

The MPMs (Multi-Processing Modules) provide a flexible architecture for choosing different connection and different handling algorithms.

Also, different versions of Apache 2 employ different procession modules.

The three main Apache MPMs are:

  1. Process (Pre-fork) MPM
  2. Worker MPM
  3. Event MPM

Old school Apache (2.2) uses mpm_worker, mpm_prefork, and mod_php. Whereas 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). It responds to a set number of processes, each of which can serve single request at a time.

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

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

However, Apache’s basic architecture can lead to heavy resource consumption, thereby, can cause issues with the server (eg- slow speed).


  • Event Driven approach
  • Handles multiple requests within one thread

Nginx employs an event-driven architecture and deals with the requests asynchronously.

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

Furthermore, you can use Nginx on low power systems, and with the systems that operate under heavy loads.


NGiNX – It has a lightweight structure, and much faster architecture than that of Apache.

2. Performance

Taking about Apache vs Nginx, both of the web servers process static and dynamic contents 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, JavaScripts files or images. Apache handles static content using its conventional file-based method.


  • At serving static content, Nginx is the king!

As Nginx’s design architecture is better equipped to handle the load, it is much faster when it comes to serving the static content.

It performs 2.5 times faster than Apache according to a benchmark test running up to 1,000 simultaneous connections.

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

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

2.2 Dynamic Content


  • Processes dynamic content within the server

Apache can process dynamic content within the web server itself without having to rely on any external components. So, it can handle your creeds itself.

Talking about Apache vs Nginx Performance: Nginx, if not better, is almost equal when dynamic content processing is considered.

Here’s the comparison of the dynamic content request numbers per second. Looks like there is little difference.


  • It doesn’t process dynamic content

Talking about dynamic content, Nginx can’t process it within the web server as Apache does. All the requests with dynamic web page content are passed to an external process (eg- PHP-FPM) for execution.

Nginx waits for the final content to come back and delivers it back to the client. Refer to this image for a clear idea:

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

P.S. This process sounds a bit complicated. However, it somewhat works in its favor and makes Nginx faster.


Static: As far as Static content is concerned, Nginx overpasses Apache.

Dynamic: Both are great at processing Dynamic content.

3. OS Support

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


  • Supports all Unix-like systems including Linux and BSD.
  • It fully supports MS Windows

Apache runs on all kinds of Unix-like systems (e.g., Linux or BSD) and has full support for Microsoft Windows.


  • Supports almost all Unix-like OS
  • Supports Windows partially.

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


Apache comes out the winner here.

4. Distributed / Centralized Configuration

Apache vs Nginx is a well-deserved topic. Their configuration makes them different from each other and make them equally interesting. Let’s see whose configuration is easier and faster.


  • Allows additional configuration on per directory basis via .htaccess files.

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


  • Doesn’t allow additional configuration

It, on the other hand, has a downside. It doesn’t provide additional configuration. However, it works in your favor as this increases the performance.
By not allowing directory configuration It can serve request faster than Apache. It doesn’t need to search for .htaccess files and the interpret the req made by the user.


Apache if configuration is considered; NGiNX if speed is.

5. Request Interpretation

In Apache vs Nginx debate, the method of interpreting requests is an interesting topic for comparison. Both of them process and interpret requests in an entirely different manner.

Their different methods make them unique and also make one a bit better than the other. Let’s explore how!


  • Passes File system location

Provides the ability to interpret req. As a physical resource on the file system location that may need more abstract evaluation. It passes requests as file system locations.

Of course, Apache does use URI locations, but they are generally for more abstract resources. And while creating or configuring a Virtual host, Apache use directory blocks under the document root.

This preference for file system locations can also be seen in the use of .htaccess files for overriding specific directory configurations.


  • Passes URI to interpret requests

Nginx was created to be both web server and a reverse proxy server. Due to the architecture request for these, Nginx works primarily with your eyes. Translating to the system when necessary.

It doesn’t provide a mechanism for specifying config. For file system directory, instead passes their URI itself. Passing requests as URI instead of file system locations allow Nginx to function easily in both web and proxy server. It configures simple by laying out how to respond to diff requests patterns.

It doesn’t check the file system until it is ready to serve the request It explains why it doesn’t implement any form of .htaccess files.

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

Also, in the Apache vs Nginx contest, NGINX again wins 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 the 500/100.


Seems like Nginx has won because of its quicker interpretation and response.

6. Feature Modules

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


  • 60 official dynamically loadable modules that can be turned On/Off

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

Its module system allows you to dynamically load or unload modules to satisfy your needs. Its modules can be turned ON or Off to add or remove functionality and to hook into the main server.

In short, Apache has several feature modules to meet your need but many of them are not used often.


  • 3rd Party core modules (not dynamically loadable)

Nginx, on the other hand, is selected and compiled into the course of the 3rd party plugins. Not dynamically loadable. The modules are useful though, they allow you to dictate what you want from your server by only including the functionality you intend to use.

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

Also, NGINX provides all of the core features of a web server, without sacrificing the lightweight and high‑performance qualities that have made it successful.

Note: Apache is like Microsoft Word and Nginx is like notepad. How? Apache has a million options but you only need a few. NGINX does those ‘a few’ things and does them 50 times faster than Apache.


NGiNX – It’s less yet important features and modules make it lighter, smarter and better web server than Apache.

7. Flexibility

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


  • Supports customization of web server through dynamic modules.

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 this.


  • Not flexible enough to support dynamic modules and loading.

This is, however, not the case for NGINX. At the beginning of 2016, NGINX got support for dynamic module loading; previously, NGINX required the admin to compile the modules into the NGINX binary.

Most modules do not yet support dynamic loading, but over time they probably will.


Apache – It clearly leads on this point.

8. Security

Apache vs Nginx security is again a debated 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 all the website that runs on its server are safe from any harm and hackers.

Thereby it offers configuration tips for DDoS attack handling, as well as the mod_evasive module for responding to HTTP DoS, DDoS, or brute force attacks.

Talking about security and Apache, you must read our detailed post on cPanel security. A secured cPanel means a secured website.


  • Better security with the smaller code base.

The NGINX code base, however, is significantly smaller by several orders of magnitude, so that is definitely a big plus from a forward-thinking security perspective. NGINX also has a list of recent security advisories. Read a post on Mitigating DDoS attacks on Nginx blog.


Nginx – It is considered more secure

9. Support

Support is something that every customer looks keenly for. It can make or break your user experience. While comparing Apache vs Nginx support, there seems to be no big difference.


  • Community support is done 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 list is maintained by the Apache Foundation. Apache server is meant to offer great support to all of 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 has support for a set of extra features regarding load-balancing, media streaming, and monitoring.


It’s a tie! The support is almost same in both. Both web servers are great.

Here’s the comparison chart on Apache vs NGINX as a summary:

Final Takeaway

Both Apache and Nginx can’t be replaced by each other, they have their strong and weak points. And after going 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 have been won by NGINX, 2 points go to Apache, and 2 were ‘draw’ between Apache and Nginx. So, we can clearly see, NGINX has a lead over Apache.

Still confused about which server is the better solution for you? Let’s find out – when to choose which!

When Choose Apache over NGINX?

i) Apache .htaccess

NGINX does not support something like the Apache’s .htaccess file. However, with Apache, you get an advantage to give the non-privileged users control over some important aspects of their website.

  • The users, obviously, are not permitted to edit the main configuration.
  • Using .htaccess files, you can override system-wide settings on a per-directory basis.
  • For optimal performance, include these .htaccess directives in the main configuration file(s).
  • In a shared hosting environment, Apache works better because of its .htaccess configuration.

P.S. For dedicated hosting or VPS Nginx stays the best option.

ii) In case of functionality limitations – use Apache

Nginx has some core modules that are very important. Howbeit, there are some functionality limitations with Nginx.

In case of some limitations or needing to use extra modules that are not supported by Nginx, you might want to choose Apache instead.

When Choose NGINX over Apache?

i) Fast Static Content Processing

Nginx can perform a much better job at handling the static files from a specific directory.

Also, the upstream server processes don’t get blocked because of the heavy, multiple static content requests as Nginx can process them concurrently. This significantly improves the overall performance of backend servers.

Nginx is incessantly trying to serve its users a better experience. It has shown some remarkable growth in year 2018. Take a glance at the key takeaways from 2018 on Nginx blog.

ii) Great for High Traffic Websites

If we talk about the speed and how many clients can be served on a high load, Nginx will always shine as a winner over Apache.

This makes Nginx significantly lightweight and great for server resources. This is why most of the web developers prefer Nginx over Apache.

Especially, the e-stores today hire a Magento developer that knows how to work on a high-traffic website, and adept in working on Nginx.

In a nutshell, when it comes to serving a website with a large volume of traffic, there is no beating Nginx.

Or, Use Both of them -Together!

Yes, Apache and Nginx can be friends too!

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

You can use Nginx in front of Apache as server proxy (as shown in the image below). This takes advantage of Nginx fast processing speed and ability to establish large no, of connection simultaneously.

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

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

Here comes the end of Apache vs Nginx contest!

Bottom Line:

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

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

Leave a Reply

Your email address will not be published. Required fields are marked *