• Barkan Saeed

Apache vs Nginx

Updated: Aug 2

Apache and Nginx are the two mostly adopted open source web server softwares and they are serving up to 50% of web traffic. Choosing a server is an important decision for your web application.

Apache is the most popular choice and Nginx is a rising star.

In this article, I will cover these both and review on how you should choose one over another or can you use both together?


Apache HTTP server was developed few years early in 1995, by an open community of developers. It is becoming the most popular web server software that serves more than 100 million websites, since its release.

Apache basically depends on processes and threads with blocking architecture means it will wait while one request is being processed.

Apache has some of the performance and scalability issues as well. Apache slows down under heavy load, as it needs to spawn new processes which consumes more memory and CPU. Further, it has another downside that it refuses to establish new connections when the administrator configured processes reaches its traffic limits.


Pronounced as “engine x”, Nginx was created in 2002 by Igor Sysoev. It is an open source software addressing the limitations that are being faced in using Apache server.

It is basically a web server that has a very strong focus on low memory usage, high performance and concurrency.

Nginx can also be used as an HTTP cache and load balancer, and a reverse proxy server for SMTP, POP3, HTTP, HTTPS and IMAP protocols. Nginx architecture is asynchronous and event-based, and has support of most platforms.

Let's look at the basic architecture of Nginx.


Apache vs Nginx

Here, i will compare how both servers distinguish in their own way

  1. Apache is easier to configure than Nginx configuration is not easy.

  2. In comparison to Nginx, Apache has excellent documentation.

  3. Nginx uses Event-driven Architecture (EDA) whereas Apache is based on process-driven architecture.

  4. Nginx has non-blocking nature while, Apache has blocking architecture.

  5. Nginx use Single-thread that means that it doesn’t create a new process for a new request. But in Apache, a new process is created for new request.

  6. Nginx has a very low memory consumption for static page but, because of requirement of creating new process for each request, Apache has a very high memory consumption.

  7. Nginx is extremely fast as compared to Apache when it comes to serve static pages.

  8. Nginx lacks support of operating systems such as OpenVMS and IBMi, but Apache supports the complete range of operating systems.

  9. As Nginx only comes with required core features, it is much lighter than Apache.

  10. The performance and scalability of Apache is heavily dependent on memory and CPU, whereas Nginx is not completely dependent on such hardware resources.

Strengths of Apache

  1. Apache offers you wide range of built-in support.

  2. Support for the latest HTTP 1.1 protocol.

  3. Simple, yet powerful file-based configuration.

  4. Support for CGI (Common Gateway Interface).

  5. Support virtual hosts, PHP scripting, Java Servlet and jsp.

  6. Support for Secured Socket Layer (SSL).

  7. Extensible Plugin Architecture.

  8. Near Real-Time Indexing.

Weaknesses of Apache

  1. Some scalability and performance issues.

  2. Slows down under load.

Strengths of Nginx

  1. Ability to handle more than 10,000 simultaneous connections.

  2. Lightweight.

  3. Takes less memory and other resources.

  4. Auto-indexing.

  5. Reverse proxy with caching.

  6. Load balancing.

  7. Fault tolerance.

  8. TLS/SSL with SNI and OCSP stapling support, via Open ssl.

  9. Embedded Perl scripting.

Weaknesses of Nginx

  1. Lack of built-in support for Python and Ruby.

  2. Nginx Plus version is not free.

Can Nginx and Apache be Used Together?

After a deeper look at the benefits and limitations of both of the choices, there is an idea of using both to make up the weakness of one with other. Although both can be used as proxy servers, however the better approach is to use Apache as backend and Nginx as a proxy server. Reason being Apache is more powerful while Nginx is faster. This approach will allow Nginx to make static content run quicker, and Apache to run scripting languages and work with backend apps.


Nginx and Apache both share many qualities and can not be used interchangeably. However, you can use both. I hope you found a better understanding regarding Apache vs Nginx, their pros and cons, and what are the conditions you can use both together.

#Apache #Hosting #Scalability #Nginx #MobileApp