For many users, the question of which web server to use can be nonexistent; however, for developers that are starting out, it can be a little daunting. It’s difficult to give a definitive answer of which is the best server to host your site on. You will have to think about your needs, determine your audience, and choose the one that works for you. In this post, we are going to take a look at some of the advantages and disadvantages of NGINX and Apache. This post will introduce you to the basic differences between Apache and NGINX web servers.
What is NGINX? Apache?
Nginx and Apache are two of the most popular options for hosting your site and each comes with their own set of pros and cons.
Apache was released in 1995 and played an important role in the growth of the internet. Nowadays, Apache serves more than 50% of websites worldwide. Due to this reason, Apache is the most widely supported and used server. Apache also comes bundled with many modules that you can install to fit your needs. Need more security? No problem! You can just write a few lines to your .htaccess file and have it work instantly. If a WordPress plugin, assuming you have WordPress installed, needs to access your .htaccess file, it will work!
However, there is one big disadvantage to using Apache as a web server. Apache is process-based, in other words, when a request is sent to the server a new thread, or process, is created which may slow things down.
This is where NGINX comes in with is asynchronous non-blocking I/O to serve requests, in other words, an event-driven architecture. Wait, what? In short, instead of creating another process and having the server/client wait for it to end, NGINX allows many events to happen at once. NGINX is great for high-traffic websites and is used by many companies, including, but not limited to Netflix, Facebook and Hulu. Igor Sysoev released NGINX in 2002 for websites such as Rambler.
Sadly, NGINX, being the younger of the two, does not have as much support as Apache does. NGINX is gaining traction as time goes on.
Here are some resources that you can use to learn more: