We have lot of guides on Nginx configuration. Then why we are saying that odd statement as title? Why Apache is superior than Nginx? The person who developed Nginx, is an Apache HTTP Server expert. He realised at that time that, Apache, being a Free Software managed By Apache Software Foundation is not suitable to easily make money. It was obvious that at least at that time Apache was resource hog, poor performer specially for LAMP server to run WordPress without CDN on low end server. Now paid Nginx, that is Nginx Plus, costs near about $1700 per instance per annum. Nginx cleverly made their modules slightly different now making to dynamically load. The result is, if a developer develops a free of cost Nginx module, Nginx Plus will make money via Nginx Plus. It is no wonder that Nginx can efficiently handle huge load with lesser resource than Apache. But Nginx developer started with a devil intention. He could develop under Apache as separate project. Apache does have other web server softwares, there are other web server softwares. Developing for Nginx community edition is helping Nginx Plus to make money. And the money is disproportionately high. If we entertain them, some F/OSS projects can incline to have such less featured “community edition” version. Nginx community edition at least in November 2016 had not all the features of HTTP/2 whereas Apache had all the features of HTTP/2.
Why Apache Is Superior Than Nginx?
Apache has huge documentation, wiki, bug fixes, IRC chat and development is handled by the expert user community and coordinated by the Apache Software Foundation. If you can make a module, your name with link will be published like developing WordPress plugin.
Nginx performs better handling static contents. Commonly we offload the static contents to CDN. Apache is highly stable to serve PHP like dynamic content burning CPU and RAM. A 32 GB dedicated server does not really cost huge these days, a 6 GB OpenVZ server costs $7/month.
There are services to cache the whole site and serve. Of course there are loadbalancer services. Most of the PHP-MySQL web software plugins, modules are designed keeping Apache in mind.
Nginx was made to out preform Apache.
try_files of Nginx is lot different than Apache rewrite rules and possibly all to ensure performance. Apache actually has lot of modules which do support many features like support of lua. Sadly, Nginx is targeted with the full knowledge of weakness of Apache, like WordPress like websites use HTML to cache.
Apache has prefork multi-process module that spawns a number of child processes when it starts, and spawns additional ones as required. It is appropriate for libraries that are not thread-safe. Apache also has a worker multi-process module (which is comparable to nginx if later is configured to use multiple processes). It is a hybrid approach that uses multiple threads within multiple processes. This is generally the most performant, and average user unlikely to see any differences between it and Nginx. Nginx can be configured to use multiple threads in multiple processes. The downside here is similar to that of Apache’s worker module, but incoming requests can still probably can be blocked by long running requests if request given to a busy child process.
None going to criticize Nginx if it was an Apache project or just another Free Software.
Nginx community edition does magic out of the box with little RAM.
Apache Means Modules And htaccees
An average user can tweak running Apache at application level using htaccees file.
Nginx – Hell of 502 Errors
Nginx does throw odd 502 error (one common reason of Nginx 502 we talked before). It is quite difficult to find out the reason of Nginx 502 in certain cases. Official support for community edition of Nginx is practically non-existent. Once we also received 502 once out of botnet attack on our one node.
Why Apache Is Superior Than Nginx In Context Of HTTP/2?
As newer features will be added to HTTP/2, an average user can use the modules when available. None going to hide any bug or tweak related to Apache.
Of course, none made money to develop Apache or develop plugins. Nginx is not really faster in real :
Apache is superior because :
- Higher security
- Easy to configure to simply run a PHP MySQL site
- Easy to add modules later
- Easy to control via htaccees file
- Support full HTTP/2 and all latest features as development mods
- Availability of experts to tweak Apache to perform better
- No marketing trick
- Huge documentation, Wiki, IRC
- Regular bug fixes
By the way, it is Cloudflare who promotes Nginx. Possibly there are such services who are paid to sell Nginx Plus. Use Nginx for reasons like for reverse proxying like we written to add IPV6 to IPV4 only server or for single board computers like Raspberry Pi. But do not develop module for Nginx.
Apache is your, mine, everyones but not of any company. If we can make Apache more better, all of us will have advantages for free of cost.