How To Choose Web Server: Nginx vs Apache

Apache and Nginx are the two most popular open source web servers that power more than half of the websites today. Both web servers are well known and able to handle diverse workloads. So the question is which web server is better and which one should you use for your next website.

What is Apache

The Apache HTTP Server was created by Robert McCool in 1995. After it is released, Apache quickly became the dominant web server on the early World Wide Web. The Apache web server has been the most popular server on the internet since 1996, peaking at over 70% market share at the end of 2005.

Pros of Apache

Apache is known for its flexibility, power, and widespread support. Apache has been available for so many years, so it has a lot of modules to expand the functionalities, detailed documentations and a huge user base.

Cons of Apache

Apache slows down under heavy load, because of the need to spawn new processes, thus consuming more computer memory. It also creates new threads that must compete with others for access to memory and CPU. Apache will also refuse new connections when traffic reaches the limit of processes configured by the administrator.

What is Nginx

Nginx is developed by Igor Sysoev as an answer to the C10K problem, which was a challenge for web servers to begin handling ten thousand concurrent connections as a requirement for the modern web. It is estimated that roughly 30% of websites are powered by Nginx in 2016.

Pros of Nginx

Unlike Apache, Nginx shines on light-weight resource utilization, ability to scale easily on minimal hardware and minimal performance drop under heavy load.

Cons of Nginx

Nginx doesn’t have any ability to process dynamic content. An external processor such as FastCGI needs to be configured with Nginx to process PHP and other dynamic requests. Nginx is relatively young compared to Apache, so there is not as many modules and extensions as Apache.

Conclusion: Apache or Nginx?

Ask yourself the following questions, if you answer is yes to any one of them, then go with Nginx.

  1. Do you own a small, budget server?
  2. Is your website mostly consists of static contents?
  3. Are you looking for a web server with low low memory footprint and modular design?

Still having trouble deciding which web server to use? See what Chris Lea has to say about Apache and Nginx.

Apache is like Microsoft Word. It has a million options but you only need six. NGINX does those six things, and it does five of them 50 times faster than Apache.