One of the common question that you might run into, when you’re looking at a web server to use, is NGINX vs Apache. Apache has been around for a very long time and is used on some very high profile sites. So how do you know which one is which and what are they gonna do a little better.
- Configuration Language - directive based for both. And when I say directive based, is you have a keyword and that’ll have some arguments. So works very much like a function.
- Processing methods - NGINX has only one processing method, whereas Apache has multiple as it has been around for a very long time. NGINX uses a worker-process model and has threads that go off and actually handle things, but they’re only ever triggerred by events. So that allows it to work in a very asynchronous way, which is one of the things that helps NGINX get it’s massive amount of concurrent connections.
- Both can be extended using third party modules, that can be dynamic. By dynamic, I mean that you don’t have to recompile NGINX or Apache in order to use them.
- Similar performance for Reverse Proxy/Dynamic Content.
- NGINX is a lot faster for serving static files as compared to Apache.
- If you’re familiar with Apache, you might know about .htaccess file, which is not present in NGINX. You can use this file to specify, configurations based on a subdirectory rather than having global config for how things can be accessed.
When it comes to getting the most out of the hardware, NGINX is probably a better choice for performance as it’s a very light weight tool.
PS: I prefer NGINX as the configuration language is easier to read. 😛
Also, I encourage you to go through this list here
to understand the difference in NGINX Open Source and NGINX Plus. And if you get done with that, do check out OpenResty