Difference WikiWeb

Difference Between Apache and Nginx

Main Difference

Apache and Nginx both are open source web servers i.e. HTTP servers and can be used for static files or dynamic pages. They are required for configuration to recognize the URLs requested by the users to route at right place. Main difference between Apache and Nginx is in their way to handle traffic and connections. In Apache multi-processing modules (MPMs) are provided to handle the client request while in Nginx the connections and clients are handled by placing them in event loops where they are processed asynchronously. The usage of CPU and memory is consistent in Nginx even at heavy loads as compare to Apache.

What is Apache?

Apache was designed as a web server. Apache uses Conventional file based methods for handling static contents and dynamic contents as well by embedding processor of languages. Apache let the additional configuration on a per-directory basis via evaluating and interpreting directives in hidden files known as .htaccess. In Apache the modules are dynamically loaded and unloaded.

What is Nginx?

Nginx was designed as a web server as well a proxy server. Nginx lacks the ability for processing the dynamic content natively. while Nginx does not let the additional configuration on a per-directory basis via evaluating and interpreting directives. Requests are faster served by the Nginx

Key Differences

  1. The usage of CPU and memory is consistent in Nginx even at heavy loads as compare to Apache.
  2. Conventional file based methods are used by Apache to handle the static contents and dynamic contents as well by embedding processor of language while Nginx lacks the ability for processing the dynamic content natively.
  3. Apache let the additional configuration on a per-directory basis via evaluating and interpreting directives in hidden files known as .htaccess while Nginx does not let the additional configuration on a per-directory basis via evaluating and interpreting directives.
  4. Apache interpret .htaccess while Nginx does not interprets the .htaccess
  5. Requests are faster served by the Nginx as compare to Apache.
  6. The security level is high in Nginx as compare to Apache as Nginx does not let to distribute the directory level configuration access to individual user.
  7. Apache was designed as a web server while Nginx was designed as a web server as well a proxy server.
  8. In Apache the modules are dynamically loaded and unloaded but in Nginx the modules are not dynamically loaded.
  9. In Nignx the modules are taken through selection and then compiles in the core software while in Apache it is done dynamically.
Harlon Moss

Harlon currently works as a quality moderator and content writer for Difference Wiki. He graduated from the University of California in 2010 with a degree in Computer Science. Follow him on Twitter @HarlonMoss