The two most popular and loved web servers out there, both together being responsible for powering 50% of the web and both capable of handling just about everything, but each have their pros and cons that will be covered in this article, so you as a developer will know the best web server for your specific stack.
Apache – An Overview
Created by Robert McCool and maintained by the Apache Software Foundation, is the most popular server on the internet and has held that title since 1996, with fantastic documentation and resources, helping to make a server with Apache a fairly painless process, as any errors will have been faced before and resolved in many forum posts.
This is normally used because of its popularity and relative ease of use, as well as the sheer flexibility and power Apache has, it sort of falls under the “Jack of all trades – master of none” role and can have a considerable amount of bloat depending on your use case.
Nginx – An Overview
Developed in 2002 as an answer to the question of whether a web server could efficiently handle 10,000 concurrent users, Nginx is another hugely popular and powerful web server that uses an asynchronous, event driven architecture to be able to offer a light weight and blazing fast web server.
Nginx is very light weight, and as a result, ridiculously quick and able to handle a lot under load without issue and is perfect for people who rely on static content over dynamic content on their server, as this is where they really excel.
How do they compare
It completely depends on your use case, but as a rule, Apache is always a good idea for general use since it can do just about everything, from dynamic content so special tasks as defined by a .htaccess, neither of which NGinx supports out of the box.
If your website is static and doesn’t have that many bells and whistles, then nginx will offer a far faster and streamlined experience for you as an admin and for the end users also.
Why not Both?
It is actually possible to use both at the same time, with Nginx in front of Apache which allows for the best of both with Nginx pushing everything it cant handle to Apache, which allows for faster sites with the stability and versatility that Apache offers!