{"id":8598,"date":"2018-04-30T10:06:50","date_gmt":"2018-04-30T10:06:50","guid":{"rendered":"http:\/\/www.esds.co.in\/blog\/?p=8598"},"modified":"2018-05-16T06:07:50","modified_gmt":"2018-05-16T06:07:50","slug":"apache-versus-nginx-open-source-web-server-software-choose","status":"publish","type":"post","link":"https:\/\/www.esds.co.in\/blog\/apache-versus-nginx-open-source-web-server-software-choose\/","title":{"rendered":"Apache versus NGINX &#8211; Which Open Source Web Server Software you should choose"},"content":{"rendered":"<p style=\"text-align: justify;\">World Wide Web (WWW), invented in 1989, made the internet ubiquitous by creating a channel for information which is now available like never before and\u00a0 can be located by a unique address (URL). Users can now access almost any information through its URL- by making HTTP requests to hosting <strong>web servers<\/strong> which are powerful interconnected computers responding to those requests. Apache and Nginx are the most popular web servers that power the Internet\u00a0 today. Both of them have unique capabilities catering to particular computing requirements, therefore making one more suitable than the other in various scenarios.<\/p><div id=\"ez-toc-container\" class=\"ez-toc-v2_0_76 counter-hierarchy ez-toc-counter ez-toc-grey ez-toc-container-direction\">\n<div class=\"ez-toc-title-container\">\n<p class=\"ez-toc-title\" style=\"cursor:inherit\">Table of Contents<\/p>\n<span class=\"ez-toc-title-toggle\"><a href=\"#\" class=\"ez-toc-pull-right ez-toc-btn ez-toc-btn-xs ez-toc-btn-default ez-toc-toggle\" aria-label=\"Toggle Table of Content\"><span class=\"ez-toc-js-icon-con\"><span class=\"\"><span class=\"eztoc-hide\" style=\"display:none;\">Toggle<\/span><span class=\"ez-toc-icon-toggle-span\"><svg style=\"fill: #999;color:#999\" xmlns=\"http:\/\/www.w3.org\/2000\/svg\" class=\"list-377408\" width=\"20px\" height=\"20px\" viewBox=\"0 0 24 24\" fill=\"none\"><path d=\"M6 6H4v2h2V6zm14 0H8v2h12V6zM4 11h2v2H4v-2zm16 0H8v2h12v-2zM4 16h2v2H4v-2zm16 0H8v2h12v-2z\" fill=\"currentColor\"><\/path><\/svg><svg style=\"fill: #999;color:#999\" class=\"arrow-unsorted-368013\" xmlns=\"http:\/\/www.w3.org\/2000\/svg\" width=\"10px\" height=\"10px\" viewBox=\"0 0 24 24\" version=\"1.2\" baseProfile=\"tiny\"><path d=\"M18.2 9.3l-6.2-6.3-6.2 6.3c-.2.2-.3.4-.3.7s.1.5.3.7c.2.2.4.3.7.3h11c.3 0 .5-.1.7-.3.2-.2.3-.5.3-.7s-.1-.5-.3-.7zM5.8 14.7l6.2 6.3 6.2-6.3c.2-.2.3-.5.3-.7s-.1-.5-.3-.7c-.2-.2-.4-.3-.7-.3h-11c-.3 0-.5.1-.7.3-.2.2-.3.5-.3.7s.1.5.3.7z\"\/><\/svg><\/span><\/span><\/span><\/a><\/span><\/div>\n<nav><ul class='ez-toc-list ez-toc-list-level-1 ' ><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-1\" href=\"https:\/\/www.esds.co.in\/blog\/apache-versus-nginx-open-source-web-server-software-choose\/#What_is_Apache\" >What is Apache?<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-2\" href=\"https:\/\/www.esds.co.in\/blog\/apache-versus-nginx-open-source-web-server-software-choose\/#What_is_Nginx\" >What is Nginx?<\/a><\/li><\/ul><\/nav><\/div>\n\n<h2 style=\"text-align: justify;\"><span class=\"ez-toc-section\" id=\"What_is_Apache\"><\/span>What is Apache?<span class=\"ez-toc-section-end\"><\/span><\/h2>\n<p style=\"text-align: justify;\">Apache is an open source web server software developed in 1995. It is easy-to-use, powerful and compatible with all major OS platforms. It has a large set of features that can be enabled by installing separate modules.\u00a0 It has a simple architecture wherein the request processing is done by various multi-processing modules (MPM). Many network services are started from a master service <strong>inetd<\/strong>. It creates a new <strong>httpd<\/strong> process for every new connection request (A process per connection).<\/p>\n<p style=\"text-align: justify;\">Apache was developed in the early days of the internet when the traffic was relatively lower on websites and the web pages were static in simple HTML. Today, there has been an explosive growth in the volume of traffic and the number of users seeking dynamic content on the web. There can be millions and perhaps multiple simultaneous connections to a large scale enterprise web server. Commonly, web browsers open multiple TCP connections to a web server to decrease page?rendering time for each user session so that resources can be downloaded instantly in parallel. Browsers keep these connections open (Keep-alive) for a certain period of time to reduce delay for future requests a user might make during the session. Each open connection exclusively reserves an httpd process. A large number of httpd process thus created can cause considerable load on the server resulting in its performance degradation and frequent crashes. With its process per connection model, Apache is not efficient to handle many concurrent connections.<\/p>\n<p style=\"text-align: justify;\">Apache creates a large number of processes which competes for a common RAM, CPU and other resources.<\/p>\n<p style=\"text-align: justify;\"><a href=\"https:\/\/www.esds.co.in\/blog\/wp-content\/uploads\/2018\/04\/What-is-apache.png\"><img loading=\"lazy\" decoding=\"async\" class=\"size-full wp-image-8600 aligncenter\" src=\"https:\/\/www.esds.co.in\/blog\/wp-content\/uploads\/2018\/04\/What-is-apache.png\" alt=\"What is apache\" width=\"655\" height=\"259\" srcset=\"https:\/\/www.esds.co.in\/blog\/wp-content\/uploads\/2018\/04\/What-is-apache.png 655w, https:\/\/www.esds.co.in\/blog\/wp-content\/uploads\/2018\/04\/What-is-apache-150x59.png 150w, https:\/\/www.esds.co.in\/blog\/wp-content\/uploads\/2018\/04\/What-is-apache-300x119.png 300w\" sizes=\"auto, (max-width: 655px) 100vw, 655px\" \/><\/a><\/p>\n<p style=\"text-align: justify;\">However, to handle a large number of requests and check resources for over- consumption, Apache developed the following strategies which can be implemented through MPM packages. But the performance is still degraded while handling concurrency.<\/p>\n<p style=\"text-align: justify;\"><strong>Worker model:<\/strong> This creates a single control process that is responsible for launching child processes. Each child process then creates a fixed number of threads, as well as a listener thread. The listener thread listens for connections and passes them to a thread for processing when they arrive. Though this model scales much better than the pre-fork method- which we discussed as a process per connection model, it can still run into scaling issues for very high-traffic sites, due to the single control process bottleneck.<\/p>\n<p style=\"text-align: justify;\"><strong>Event model:<\/strong> This is similar to the worker model, but it creates one listener thread which listens for connections and passes them to a worker thread for processing. This MPM handles long-running connections much more efficiently on a single thread (Keep-alive handling). Since Apache 2.4, the event model has been deemed stable and is now also the default setting if the operating system can support it.<\/p>\n<h2 style=\"text-align: justify;\"><span class=\"ez-toc-section\" id=\"What_is_Nginx\"><\/span>What is Nginx?<span class=\"ez-toc-section-end\"><\/span><\/h2>\n<p style=\"text-align: justify;\">Nginx is also an open source web server software which was developed in 2002 to improve the performance of Apache-based services and for high concurrency. It is highly scalable and can handle many concurrent connections. NGINX uses an asynchronous, event-driven architecture to handle these massive amounts of connections. This architecture makes handling high and fluctuating loads much more predictable in terms of RAM usage, CPU usage, and latency. NGINX does not set up extra worker processes per connection. In most cases, the recommended NGINX configuration is running one worker process per CPU, maximizing the hardware\u2019s efficiency. Each worker process can handle thousands of HTTP connections simultaneously. This results in a highly regarded implementation that is lightweight, scalable, and high performance.<\/p>\n<p style=\"text-align: justify;\"><a href=\"https:\/\/www.esds.co.in\/blog\/wp-content\/uploads\/2018\/04\/What-is-Nginx.png\"><img loading=\"lazy\" decoding=\"async\" class=\"size-full wp-image-8601 aligncenter\" src=\"https:\/\/www.esds.co.in\/blog\/wp-content\/uploads\/2018\/04\/What-is-Nginx.png\" alt=\"What is Nginx\" width=\"655\" height=\"434\" srcset=\"https:\/\/www.esds.co.in\/blog\/wp-content\/uploads\/2018\/04\/What-is-Nginx.png 655w, https:\/\/www.esds.co.in\/blog\/wp-content\/uploads\/2018\/04\/What-is-Nginx-150x99.png 150w, https:\/\/www.esds.co.in\/blog\/wp-content\/uploads\/2018\/04\/What-is-Nginx-300x199.png 300w\" sizes=\"auto, (max-width: 655px) 100vw, 655px\" \/><\/a><\/p>\n<p style=\"text-align: justify;\"><strong>Which are the other differences between the two?<\/strong><\/p>\n<table>\n<tbody>\n<tr>\n<td width=\"206\"><strong>Parameters<\/strong><\/td>\n<td width=\"213\"><strong>Apache<\/strong><\/td>\n<td width=\"213\"><strong>NGINX<\/strong><\/td>\n<\/tr>\n<tr>\n<td width=\"206\">&nbsp;<\/p>\n<p>Speed<\/td>\n<td width=\"213\">&nbsp;<\/p>\n<p>Not fast as NGINX<\/td>\n<td width=\"213\">NGINX is 2.5 times faster than the Apache web server in running concurrent connections. NGINX serves static content much faster than Apache.<\/p>\n<p>&nbsp;<\/td>\n<\/tr>\n<tr>\n<td width=\"206\">Configuration<\/td>\n<td width=\"213\">Easy to configure<\/td>\n<td width=\"213\">\u00a0Easy to configure.<\/td>\n<\/tr>\n<tr>\n<td width=\"206\">OS support<\/td>\n<td width=\"213\">Runs on Linux, Windows.<\/td>\n<td width=\"213\">Runs on Linux. It runs on Windows also but not efficiently.<\/td>\n<\/tr>\n<tr>\n<td width=\"206\">Security<\/td>\n<td width=\"213\">Secure<\/td>\n<td width=\"213\">Secure<\/td>\n<\/tr>\n<tr>\n<td width=\"206\">Customisation\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 (Dynamic Loading)<\/td>\n<td width=\"213\">Easy. You can simply add or remove modules<\/td>\n<td width=\"213\">Highly customisable. Some modules require being compiled into binary.<\/td>\n<\/tr>\n<tr>\n<td width=\"206\">&nbsp;<\/p>\n<p>Documentation<\/td>\n<td width=\"213\">&nbsp;<\/p>\n<p>Good documentation available<\/td>\n<td width=\"213\">\u00a0Initially, limited documentation was available in only Russian language.\u00a0 Now NGINX has a good documentation.<\/td>\n<\/tr>\n<tr>\n<td width=\"206\">&nbsp;<\/p>\n<p>Support<\/td>\n<td width=\"213\">&nbsp;<\/p>\n<p>A large community support is available free of cost. Third party organisations also provide premium support.<\/td>\n<td width=\"213\">&nbsp;<\/p>\n<p>A large community support is available free of cost. Official support NGINX plus is provided at a premium.<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p style=\"text-align: justify;\"><strong>Which of them is the best? What is the best configuration?<\/strong><\/p>\n<p style=\"text-align: justify;\">As explained, Apache or NGINX both are the best choices according to a situation. However, the best configuration is combining both of them to deploy in a single environment- NGINX as a proxy server in front of an Apache web server. NGINX performs the HTTP?related heavy lifting like serving static files, caching content, and offloading slow HTTP connections while the Apache web server can run the application code in a safe and secure environment without concerning about extra loads. NGINX can serve as a proxy that forwards HTTP requests to upstream web servers (such as an Apache backend) and FastCGI, Memcached, SCGI, and uWSGI servers. NGINX does not seek to implement the huge range of functionality necessary to run an application but relies on specialized third-party servers such as PHP?FPM, Node.js, and even Apache. This configuration is widely used in an enterprise setup.<\/p>\n<p style=\"text-align: justify;\"><a href=\"https:\/\/www.esds.co.in\/blog\/wp-content\/uploads\/2018\/04\/Nginx-web-server-as-proxy.png\"><img loading=\"lazy\" decoding=\"async\" class=\"size-full wp-image-8602 aligncenter\" src=\"https:\/\/www.esds.co.in\/blog\/wp-content\/uploads\/2018\/04\/Nginx-web-server-as-proxy.png\" alt=\"Nginx web server as proxy\" width=\"655\" height=\"272\" srcset=\"https:\/\/www.esds.co.in\/blog\/wp-content\/uploads\/2018\/04\/Nginx-web-server-as-proxy.png 655w, https:\/\/www.esds.co.in\/blog\/wp-content\/uploads\/2018\/04\/Nginx-web-server-as-proxy-150x62.png 150w, https:\/\/www.esds.co.in\/blog\/wp-content\/uploads\/2018\/04\/Nginx-web-server-as-proxy-300x125.png 300w\" sizes=\"auto, (max-width: 655px) 100vw, 655px\" \/><\/a><\/p>\n<p style=\"text-align: justify;\"><strong>Summary:<\/strong><\/p>\n<p style=\"text-align: justify;\">Apache is like Microsoft Word\u2014It has many features but you only need few. NGINX has those few features, and are 50\u00a0times faster than Apache.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>World Wide Web (WWW), invented in 1989, made the internet ubiquitous by creating a channel for information which is now available like never before and\u00a0 can be located by a unique address (URL). Users can now access almost any information through its URL- by making HTTP requests to hosting web servers which are powerful interconnected&#8230; <\/p>\n<div class=\"clear\"><\/div>\n<p><a href=\"https:\/\/www.esds.co.in\/blog\/apache-versus-nginx-open-source-web-server-software-choose\/\" class=\"gdlr-button small excerpt-read-more\">Read More<\/a><\/p>\n","protected":false},"author":37,"featured_media":8602,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"om_disable_all_campaigns":false,"_monsterinsights_skip_tracking":false,"_monsterinsights_sitenote_active":false,"_monsterinsights_sitenote_note":"","_monsterinsights_sitenote_category":0,"footnotes":""},"categories":[187],"tags":[155,1705,1703,1706,1702,1704,123],"class_list":["post-8598","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-general","tag-apache","tag-apache-web-server","tag-nginx","tag-nginx-web-server","tag-open-source-web-server-software","tag-proxy-server","tag-web-servers"],"aioseo_notices":[],"_links":{"self":[{"href":"https:\/\/www.esds.co.in\/blog\/wp-json\/wp\/v2\/posts\/8598","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.esds.co.in\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.esds.co.in\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.esds.co.in\/blog\/wp-json\/wp\/v2\/users\/37"}],"replies":[{"embeddable":true,"href":"https:\/\/www.esds.co.in\/blog\/wp-json\/wp\/v2\/comments?post=8598"}],"version-history":[{"count":5,"href":"https:\/\/www.esds.co.in\/blog\/wp-json\/wp\/v2\/posts\/8598\/revisions"}],"predecessor-version":[{"id":8637,"href":"https:\/\/www.esds.co.in\/blog\/wp-json\/wp\/v2\/posts\/8598\/revisions\/8637"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.esds.co.in\/blog\/wp-json\/wp\/v2\/media\/8602"}],"wp:attachment":[{"href":"https:\/\/www.esds.co.in\/blog\/wp-json\/wp\/v2\/media?parent=8598"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.esds.co.in\/blog\/wp-json\/wp\/v2\/categories?post=8598"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.esds.co.in\/blog\/wp-json\/wp\/v2\/tags?post=8598"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}