{"id":4665,"date":"2017-01-22T00:57:30","date_gmt":"2017-01-21T16:57:30","guid":{"rendered":"https:\/\/www.icocean.com\/blog\/?p=4665"},"modified":"2017-01-22T00:57:53","modified_gmt":"2017-01-21T16:57:53","slug":"nginx-vs-apache-procon-review-uses-hosting-for-each","status":"publish","type":"post","link":"https:\/\/www.icocean.com\/blog\/?p=4665","title":{"rendered":"NGINX vs. Apache (Pro\/Con Review, Uses, &#038; Hosting for Each)"},"content":{"rendered":"<p>By: Ryan Frankel Posted: May 9, 2016<\/p>\n<p>&nbsp;<\/p>\n<blockquote><p><strong>TL; DR:<\/strong> We assess two of the most popular web servers: <a href=\"http:\/\/www.hostingadvice.com\/how-to\/nginx-vs-apache\/#nginx-overview\">NGINX<\/a> and <a href=\"http:\/\/www.hostingadvice.com\/how-to\/nginx-vs-apache\/#apache-overview\">Apache<\/a>, on six key points of comparison (<a href=\"http:\/\/www.hostingadvice.com\/how-to\/nginx-vs-apache\/#performance\">performance for static vs. dynamic content<\/a>, <a href=\"http:\/\/www.hostingadvice.com\/how-to\/nginx-vs-apache\/#operating-system\">OS support<\/a>, <a href=\"http:\/\/www.hostingadvice.com\/how-to\/nginx-vs-apache\/#security\">security<\/a>, <a href=\"http:\/\/www.hostingadvice.com\/how-to\/nginx-vs-apache\/#flexibility\">flexibility<\/a>, <a href=\"http:\/\/www.hostingadvice.com\/how-to\/nginx-vs-apache\/#docs\">documentation<\/a>, and <a href=\"http:\/\/www.hostingadvice.com\/how-to\/nginx-vs-apache\/#support\">support<\/a>). We\u2019ll find that the two are worthy competitors, but Apache\u2019s .htaccess file makes it particularly appealing to shared hosting customers. Meanwhile, NGINX reigns supreme for dynamic content support, and due in part to its more advanced feature offerings, is most popularly used by VPS and dedicated hosting users. Finally, we\u2019ll go over our <a href=\"http:\/\/www.hostingadvice.com\/how-to\/nginx-vs-apache\/#summary\">recommendations for hosting your next web app project<\/a>.<\/p><\/blockquote>\n<p>There was a time (~late 90s-2011) when the Apache web server served around 60 percent \u2014 and at times even more \u2014 of the world\u2019s websites. That percentage has since fallen below 35 and is <a href=\"http:\/\/news.netcraft.com\/archives\/2016\/01\/26\/january-2016-web-server-survey.html\" target=\"_blank\">still dropping at quite a significant rate<\/a>. Meanwhile, Microsoft\u2019s IIS web server has held a somewhat steady, slightly increasing, share of the market, reaching 30 percent today. Third place is held by a competitor called NGINX (pronounced \u201cengine-x\u201d), which currently serves around 16 percent of all sites, and that rate is steadily growing by about one percent each year.<\/p>\n<p>I\u2019ll note that some <a href=\"http:\/\/w3techs.com\/technologies\/overview\/web_server\/all\" target=\"_blank\">web surveyors place the market shares of Apache and NGINX much higher<\/a>, considering IIS a lesser competitor. Reality likely resides somewhere in the middle, but the overall trends are clear. Considering only the busiest sites on the Web, Apache holds about 46 percent of the market share, but that portion drops by about four percent annually; NGINX holds a strong second place with 24 percent of the market share and is growing at a rate of about three percent each year. Clearly NGINX is enticing the world\u2019s biggest web properties with something!<!--more--><\/p>\n<div id=\"attachment_11003\" class=\"wp-caption alignleft\">\n<p><img loading=\"lazy\" decoding=\"async\" class=\"size-full wp-image-11003\" src=\"https:\/\/www.icocean.com\/blog\/wp-content\/uploads\/auto_save_image\/2017\/01\/165731fZN.jpg\" sizes=\"auto, (max-width: 686px) 100vw, 686px\" srcset=\"https:\/\/www.icocean.com\/blog\/wp-content\/uploads\/auto_save_image\/2017\/01\/165731fZN.jpg 686w, http:\/\/www.hostingadvice.com\/wp-content\/uploads\/2016\/03\/Web-Server-Market-Share-Comparison-72x21.jpg 72w, http:\/\/www.hostingadvice.com\/wp-content\/uploads\/2016\/03\/Web-Server-Market-Share-Comparison-175x51.jpg 175w, http:\/\/www.hostingadvice.com\/wp-content\/uploads\/2016\/03\/Web-Server-Market-Share-Comparison-92x27.jpg 92w, http:\/\/www.hostingadvice.com\/wp-content\/uploads\/2016\/03\/Web-Server-Market-Share-Comparison-406x119.jpg 406w, http:\/\/www.hostingadvice.com\/wp-content\/uploads\/2016\/03\/Web-Server-Market-Share-Comparison-285x84.jpg 285w, http:\/\/www.hostingadvice.com\/wp-content\/uploads\/2016\/03\/Web-Server-Market-Share-Comparison-358x105.jpg 358w\" alt=\"Netcraft Survey Results for Web Server Market Shares\" width=\"686\" height=\"201\" \/><\/p>\n<p class=\"wp-caption-text\">NetCraft\u2019s Web Server Market Share Comparison: Across All Sites (Left) &amp; Across Top Billion Busiest Sites (Right)<\/p>\n<\/div>\n<p>In this article, we\u2019ll make NGINX\/Apache comparisons for the following areas of interest:<\/p>\n<div>\n<ul>\n<li><a href=\"http:\/\/www.hostingadvice.com\/how-to\/nginx-vs-apache\/#performance\">Performance<\/a><\/li>\n<li><a href=\"http:\/\/www.hostingadvice.com\/how-to\/nginx-vs-apache\/#operating-system\">OS Support<\/a><\/li>\n<li><a href=\"http:\/\/www.hostingadvice.com\/how-to\/nginx-vs-apache\/#security\">Security<\/a><\/li>\n<\/ul>\n<\/div>\n<div>\n<ul>\n<li><a href=\"http:\/\/www.hostingadvice.com\/how-to\/nginx-vs-apache\/#flexibility\">Flexibility<\/a><\/li>\n<li><a href=\"http:\/\/www.hostingadvice.com\/how-to\/nginx-vs-apache\/#docs\">Docs<\/a><\/li>\n<li><a href=\"http:\/\/www.hostingadvice.com\/how-to\/nginx-vs-apache\/#support\">User Support<\/a><\/li>\n<\/ul>\n<\/div>\n<p>First, let\u2019s make sure we\u2019re all familiar with the web servers we\u2019re comparing\u2026 Or you can skip to our <a href=\"http:\/\/www.hostingadvice.com\/how-to\/nginx-vs-apache\/#summary\">summary review of Apache and NGINX<\/a>, which includes our <a href=\"http:\/\/www.hostingadvice.com\/reviews\/linux\/\" target=\"_blank\">hosting recommendations<\/a>.<\/p>\n<div class=\"h2-header\">\n<h2 id=\"apache-overview\">Apache Overview<\/h2>\n<div class=\"watermark\"><\/div>\n<\/div>\n<p>Apache is the web server component of the popular LAMP (Linux, Apache, MySQL, PHP) stack. Though there are many other web stack components these days (e.g., NodeJS, rich clients JS frameworks, various cloud services, etc.), LAMP still remains very popular.<\/p>\n<p>The Apache web server has a rich set of features that can be enabled through installing one of the approximately\u00a060 <a href=\"http:\/\/www.hostingadvice.com\/how-to\/nginx-vs-apache\/#apache-modules\">official modules<\/a>\u00a0or one of the many other unofficial modules\u00a0that also\u00a0exist.<\/p>\n<p>Over the years, Apache has developed several methods for processing web requests to improve its efficiency (mainly RAM usage and latency). In a world where ever more concurrent web requests needed to be handled by sites, and where the served page sizes got a lot bigger, these newer methodologies were necessary.<\/p>\n<p>The Apache request processing methodology can be configured in one of three ways. I\u2019ll break down the three main <a title=\"Apache Multi-Processing Modules\" href=\"http:\/\/www.hostingadvice.com\/external\/?site=882f788a96a4f71de4f78178aff64dfe4577f46229713bf3a881dbb750f5bec82018be49e13ac722e1d5745fadfd0a3a\" target=\"_blank\">Multi-Processing Modules<\/a>\u00a0(MPMs) below:<\/p>\n<ol>\n<li><strong><a title=\"\" href=\"http:\/\/www.hostingadvice.com\/external\/?site=882f788a96a4f71de4f78178aff64dfe4577f46229713bf35d5a966604e937ee4d32e6fea51316fbb940105a6a3df89b8025ac3537390bf7\" target=\"_blank\">process model<\/a>:<\/strong> This is the original \u201cpre-fork\u201d method; it does not scale well with many concurrent connections, as it consumes a lot of RAM and might even refuse connections at high loads. Smaller sites won\u2019t notice this, but larger sites likely will.<\/li>\n<li><strong><a title=\"\" href=\"http:\/\/www.hostingadvice.com\/external\/?site=882f788a96a4f71de4f78178aff64dfe4577f46229713bf35d5a966604e937eef0cc1417c9c70bd4842796b95ddbac5f25924dac3ffbd806\" target=\"_blank\">worker model<\/a>:<\/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, it can still run into scaling issues for very high-traffic sites, due to the single control process bottleneck.<\/li>\n<li><strong><a title=\"\" href=\"http:\/\/www.hostingadvice.com\/external\/?site=882f788a96a4f71de4f78178aff64dfe4577f46229713bf35d5a966604e937eec1565014e3773887ac0d418618a2b4da\" target=\"_blank\">event model<\/a>:<\/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 (KeepAlive 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.<\/li>\n<\/ol>\n<p>You can also try <a title=\"\" href=\"http:\/\/www.hostingadvice.com\/external\/?site=762f3dd1b6d29f265e08d3a14c0abacae2ded72d9bf10c57f3c36fc61e33bd55e2dfa4895f82f072c038b4977cc808cf6e5f4e2342ef3ba88025ac3537390bf7\" target=\"_blank\">compile-time and run-time options<\/a> for improving Apache performance.<\/p>\n<div class=\"h2-header\">\n<h2 id=\"nginx-overview\">NGINX Overview<\/h2>\n<div class=\"watermark\"><\/div>\n<\/div>\n<p>NGINX was created in response to the <a href=\"http:\/\/www.kegel.com\/c10k.html\" target=\"_blank\">C10K challenge<\/a> of handling at least 10,000 simultaneous client connections on a single server. 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.<\/p>\n<div id=\"attachment_11001\" class=\"wp-caption alignleft\">\n<p><img loading=\"lazy\" decoding=\"async\" class=\"size-full wp-image-11001\" src=\"https:\/\/www.icocean.com\/blog\/wp-content\/uploads\/auto_save_image\/2017\/01\/165732XpH.jpg\" sizes=\"auto, (max-width: 686px) 100vw, 686px\" srcset=\"https:\/\/www.icocean.com\/blog\/wp-content\/uploads\/auto_save_image\/2017\/01\/165732XpH.jpg 686w, http:\/\/www.hostingadvice.com\/wp-content\/uploads\/2016\/03\/nginx-architecture-72x45.jpg 72w, http:\/\/www.hostingadvice.com\/wp-content\/uploads\/2016\/03\/nginx-architecture-88x55.jpg 88w, http:\/\/www.hostingadvice.com\/wp-content\/uploads\/2016\/03\/nginx-architecture-92x57.jpg 92w, http:\/\/www.hostingadvice.com\/wp-content\/uploads\/2016\/03\/nginx-architecture-310x193.jpg 310w, http:\/\/www.hostingadvice.com\/wp-content\/uploads\/2016\/03\/nginx-architecture-217x135.jpg 217w, http:\/\/www.hostingadvice.com\/wp-content\/uploads\/2016\/03\/nginx-architecture-273x170.jpg 273w\" alt=\"Map of NGINX Event-Driven Architecture\" width=\"686\" height=\"427\" \/><\/p>\n<p class=\"wp-caption-text\">NGINX\u2019s event-driven architecture helps predict RAM and CPU usage, as well as latency, for high\/fluctuating loads.<\/p>\n<\/div>\n<p>The main difference between NGINX and Apache, in terms of the event models, is that 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.<\/p>\n<p>NGINX also has a rich set of features and can perform various server roles:<\/p>\n<ul>\n<li>A reverse proxy server for the HTTP, HTTPS, SMTP, POP3, and IMAP protocol<\/li>\n<li>A load balancer and an HTTP cache<\/li>\n<li>A frontend proxy for Apache and other web servers, combining the flexibility of Apache with the good static content performance of NGINX<\/li>\n<\/ul>\n<p>NGINX supports FastCGI and SCGI handlers for serving dynamic content scripts such as PHP and Python. It uses the LEMP stack: a variation of LAMP using the phonetic spelling of NGINX (Linux, \u201c<em>En-juhn-ex<\/em>,\u201d MySQL, PHP).<\/p>\n<div class=\"h2-header\">\n<h2>NGINX vs Apache: Performance, Support, Security, &amp; Docs Compared<\/h2>\n<div class=\"watermark\"><\/div>\n<\/div>\n<p>Now let\u2019s compare both web servers in several fields. We\u2019ll find that Apache and NGINX are worthy competitors, but depending on your use case, one may be better suited for your project than the other. Don\u2019t worry, I\u2019ll sum it up nicely in my <a href=\"http:\/\/www.hostingadvice.com\/how-to\/nginx-vs-apache\/#summary\">concluding NGINX\/Apache comparison<\/a>.<\/p>\n<h3 id=\"performance\">Performance<\/h3>\n<p>Below we\u2019ll contrast the performance of Apache (using the event MPM) with that of NGINX in both static and dynamic content serving roles.<\/p>\n<h4>Static Content<\/h4>\n<p><a href=\"http:\/\/www.eschrade.com\/page\/performance-of-apache-2-4-with-the-event-mpm-compared-to-nginx\/\" target=\"_blank\">NGINX is about 2.5 times faster than Apache based on the results of a benchmark test<\/a> running up to 1,000 concurrent connections. Another <a href=\"http:\/\/www.speedemy.com\/apache-vs-nginx-2015\/\" target=\"_blank\">benchmark running with 512 concurrent connections<\/a>, showed that NGINX is about two times faster and consumed a bit less memory (4%).<\/p>\n<p>Clearly, NGINX serves static content much faster than Apache. If you need to serve a lot of static content at high concurrency levels, NGINX can be a real help.<\/p>\n<h4>Dynamic Content<\/h4>\n<p>A <a href=\"http:\/\/www.speedemy.com\/apache-vs-nginx-2015\/\" target=\"_blank\">2015 benchmark comparing dynamic content serving by Apache and NGINX<\/a> found that the Apache event MPM, when paired with the PHP-FPM module, can handle about the same concurrency as can NGINX with PHP. Another <a href=\"https:\/\/www.conetix.com.au\/blog\/apache-vs-nginx-vs-openlitespeed-part-1\" target=\"_blank\">web server performance comparison<\/a> showed similar results. The reason for this is almost all of the request processing time is spent in the PHP runtime environment rather than the core part of the web server. The PHP runtime environment is pretty similar between both web servers.<\/p>\n<div id=\"attachment_11008\" class=\"wp-caption alignleft\">\n<p><img loading=\"lazy\" decoding=\"async\" class=\"size-full wp-image-11008\" src=\"https:\/\/www.icocean.com\/blog\/wp-content\/uploads\/auto_save_image\/2017\/01\/165732StO.jpg\" sizes=\"auto, (max-width: 686px) 100vw, 686px\" srcset=\"https:\/\/www.icocean.com\/blog\/wp-content\/uploads\/auto_save_image\/2017\/01\/165732StO.jpg 686w, http:\/\/www.hostingadvice.com\/wp-content\/uploads\/2016\/03\/apache-vs-nginx-dynamic-content-benchmark-72x18.jpg 72w, http:\/\/www.hostingadvice.com\/wp-content\/uploads\/2016\/03\/apache-vs-nginx-dynamic-content-benchmark-175x43.jpg 175w, http:\/\/www.hostingadvice.com\/wp-content\/uploads\/2016\/03\/apache-vs-nginx-dynamic-content-benchmark-92x23.jpg 92w, http:\/\/www.hostingadvice.com\/wp-content\/uploads\/2016\/03\/apache-vs-nginx-dynamic-content-benchmark-406x100.jpg 406w, http:\/\/www.hostingadvice.com\/wp-content\/uploads\/2016\/03\/apache-vs-nginx-dynamic-content-benchmark-285x70.jpg 285w, http:\/\/www.hostingadvice.com\/wp-content\/uploads\/2016\/03\/apache-vs-nginx-dynamic-content-benchmark-358x88.jpg 358w\" alt=\"Speedemy's dynamic content benchmark - Apache vs NGINX\" width=\"686\" height=\"169\" \/><\/p>\n<p class=\"wp-caption-text\">Speedemy\u2019s web server benchmarking found similar results using both Apache and NGINX to serve dynamic content.<\/p>\n<\/div>\n<p>In terms of PHP (and likely other languages as well), the dynamic page server performance is practically equal with a proper Apache module setup (PHP-FPM + FastCGI). If you really want to speed up dynamic pages, you have several options: add a Varnish or Memcached caching layer, switch to a faster PHP runtime (e.g., HHVM), do load balancing, or add more hardware.<\/p>\n<p>Unfortunately, the superior static page serving performance of NGINX does not translate to the serving of dynamic pages. Both web servers score about the same on this point.<\/p>\n<h3 id=\"operating-system\">Operating System Support<\/h3>\n<p>Apache runs on all kinds of Unix-like systems (e.g., Linux or BSD) and has full support for Microsoft Windows. NGINX also runs on several modern Unix-like systems and has some support for Windows, but its Windows performance is not as strong as that of other platforms.<\/p>\n<p>Apache comes out somewhat stronger here.<\/p>\n<h3 id=\"security\">Security<\/h3>\n<p>Both projects have an excellent security track record for their C-based code base. The NGINX code base, however, is significantly smaller by several orders of magnitude, so that is definitely a big plus from a forward-thinking security perspective.<\/p>\n<p>There is <a title=\"\" href=\"http:\/\/www.hostingadvice.com\/external\/?site=882f788a96a4f71de4f78178aff64dfe4577f46229713bf3eda51b87ef758c32582d0525164fe45fbd92dd08f0fdb1c4\" target=\"_blank\">vulnerability reporting available for Apache 2.2 and 2.4<\/a>. NGINX also has a list of recent <a title=\"NGINX security advisories\" href=\"http:\/\/www.hostingadvice.com\/external\/?site=21d5fde7e545f75d3ea604e2d7ebec44351bdbd0ab065c236d809834c047a70ba29042de84593300876e7862ca510a98\" target=\"_blank\">security advisories<\/a>. Apache offers <a title=\"\" href=\"http:\/\/www.hostingadvice.com\/external\/?site=882f788a96a4f71de4f78178aff64dfe4577f46229713bf3ac64c08dc7dc0c6680ab0e7084ea35d2eda51b87ef758c322ba8faa28c8c12ef9199892833345f29\" target=\"_blank\">configuration tips for DDoS attack handling<\/a>, as well as the <a href=\"http:\/\/www.zdziarski.com\/blog\/?page_id=442\" target=\"_blank\">mod_evasive module<\/a> for responding to HTTP DoS, DDoS, or brute force attacks. You can also find helpful resources for <a title=\"\" href=\"http:\/\/www.hostingadvice.com\/external\/?site=882f788a96a4f71d60b03e67d5b422fcc36fa818dbc560a3a0de01f80c872c91f59b03367eb05a2781f56a29bee8f77e9ac78de6200b5a9014c4bc4c6f6a6aa4b53f8a478c8e95b86cc512249c41a519\" target=\"_blank\">dealing with DDoS threats on the NGINX blog<\/a>.<\/p>\n<h3 id=\"flexibility\">Flexibility<\/h3>\n<p>Customizations to the web server can be done through writing modules. Apache has had dynamic module loading for the longest time, so all Apache modules support this.<\/p>\n<p>This is, however, not the case for NGINX. In the beginning of 2016, NGINX got support for dynamic module loading; previously, NGINX required the admin to compile the modules into the NGINX binary. Most modules do not yet support dynamic loading, but over time they probably will.<\/p>\n<p>Apache clearly leads on this point.<\/p>\n<h4>Dynamic Module Loading &amp; Modules<\/h4>\n<p>Both Apache and NGINX have a large and growing set of specific feature modules.<\/p>\n<p>Apache Modules:<\/p>\n<ul>\n<li id=\"apache-modules\">Official Modules (Found in the Modules section of the <a href=\"http:\/\/www.hostingadvice.com\/how-to\/nginx-vs-apache\/#docs\">Apache documentation<\/a>)<\/li>\n<li><a href=\"https:\/\/en.wikipedia.org\/wiki\/List_of_Apache_modules\" target=\"_blank\">Module List on Wikipedia<\/a><\/li>\n<\/ul>\n<p>Unfortunately, a well-maintained list of all third-party modules does not seem to exist yet.<\/p>\n<div id=\"attachment_11010\" class=\"wp-caption alignleft\">\n<p><img loading=\"lazy\" decoding=\"async\" class=\"size-full wp-image-11010\" src=\"https:\/\/www.icocean.com\/blog\/wp-content\/uploads\/auto_save_image\/2017\/01\/165733N5U.jpg\" sizes=\"auto, (max-width: 686px) 100vw, 686px\" srcset=\"https:\/\/www.icocean.com\/blog\/wp-content\/uploads\/auto_save_image\/2017\/01\/165733N5U.jpg 686w, http:\/\/www.hostingadvice.com\/wp-content\/uploads\/2016\/03\/Apache-vs-NGINX-72x43.jpg 72w, http:\/\/www.hostingadvice.com\/wp-content\/uploads\/2016\/03\/Apache-vs-NGINX-93x55.jpg 93w, http:\/\/www.hostingadvice.com\/wp-content\/uploads\/2016\/03\/Apache-vs-NGINX-92x54.jpg 92w, http:\/\/www.hostingadvice.com\/wp-content\/uploads\/2016\/03\/Apache-vs-NGINX-327x193.jpg 327w, http:\/\/www.hostingadvice.com\/wp-content\/uploads\/2016\/03\/Apache-vs-NGINX-229x135.jpg 229w, http:\/\/www.hostingadvice.com\/wp-content\/uploads\/2016\/03\/Apache-vs-NGINX-288x170.jpg 288w\" alt=\"Comparing NGINX and Apache\" width=\"686\" height=\"405\" \/><\/p>\n<p class=\"wp-caption-text\">NGINX and Apache both have rich and ever-growing feature sets, but the best use cases vary for each web server.<\/p>\n<\/div>\n<p>NGINX modules:<\/p>\n<ul>\n<li>Official Modules (found in the Modules Reference section of the <a href=\"http:\/\/www.hostingadvice.com\/how-to\/nginx-vs-apache\/#docs\">NGINX documentation<\/a>)<\/li>\n<li><a title=\"\" href=\"http:\/\/www.hostingadvice.com\/external\/?site=882f788a96a4f71d60b03e67d5b422fc29fc5a18d07c355c2b139fa63b1f15111afa6c149e3542690f7a415482ea2a5d\" target=\"_blank\">Third-Party Modules<\/a><\/li>\n<\/ul>\n<p>It\u2019s not easy to say if Apache or NGINX has a clear advantage here, but most of the core needed module functionality (e.g., proxy-ing, caching, load-balancing, etc.) is available for both web servers. NGINX looks stronger in the area of acting as a reverse proxy for TCP and email (SMTP, IMAP, POP3) connections. In the area of media streaming modules, the commercial NGINX Plus version also looks stronger.<\/p>\n<h4>Apache .htaccess<\/h4>\n<p>NGINX does not support something like the Apache\u2019s .htaccess file.<\/p>\n<p>Using .htaccess files, one can override system-wide settings on a per directory basis; however, for optimal performance, these .htaccess directives should be included in the main configuration file(s) whenever possible. This is not possible in the case of shared hosting environments, but it can add a lot of flexibility for shared hosting users.<\/p>\n<h3 id=\"docs\">Documentation<\/h3>\n<p>The documentation for both <a title=\"Apache docs\" href=\"http:\/\/www.hostingadvice.com\/external\/?site=882f788a96a4f71de4f78178aff64dfe4577f46229713bf35d5a966604e937ee8c1cfaaa8b1f2fac\" target=\"_blank\">Apache<\/a>\u00a0and <a title=\"NGINX\" href=\"http:\/\/www.hostingadvice.com\/external\/?site=21d5fde7e545f75d3ea604e2d7ebec442a9cc8503ffab63475c038cdd144d44f\" target=\"_blank\">NGINX<\/a> are excellent, including the <a title=\"NGINX wiki\" href=\"http:\/\/www.hostingadvice.com\/external\/?site=882f788a96a4f71d60b03e67d5b422fc29fc5a18d07c355c2b139fa63b1f15117cb5d9c8f576eb4b\" target=\"_blank\">NGINX wiki<\/a>. NGINX also offers online and on-location training sessions on a variety of NGINX topics \u2014 including exam certifications.<\/p>\n<h3 id=\"support\">Support<\/h3>\n<p>Apache community support is done through mailing lists, IRC, and <a href=\"http:\/\/stackoverflow.com\/questions\/tagged\/apache\" target=\"_blank\">Stack Overflow<\/a>. Commercial Apache support is available from a number of third-party companies, such as OpenLogic, but no official list is maintained by the Apache Foundation.<\/p>\n<p>NGINX has community support through mailing lists, IRC, <a href=\"http:\/\/stackoverflow.com\/questions\/tagged\/nginx\" target=\"_blank\">Stack Overflow<\/a>, and a forum. The company behind NGINX offers a commercial product called NGINX Plus, which has support for a set of extra features regarding load-balancing, media streaming, and monitoring.<\/p>\n<div class=\"h2-header\">\n<h2 id=\"summary\">Apache vs NGINX in Review<\/h2>\n<div class=\"watermark\"><\/div>\n<\/div>\n<p>Both web servers, in their latest versions, can compete with each other in most areas. For static content NGINX is king, but for dynamic content the performance difference is quite slim. NGINX does shine with some of its more advanced features (media streaming, reverse proxying for non-HTTP protocols), as well as its commercial support and training.<\/p>\n<p><a href=\"http:\/\/www.hostingadvice.com\/reviews\/cheap\/\" target=\"_blank\">Shared hosting<\/a> users might prefer the convenience of the Apache .htaccess file, and Apache better supports loading various dynamic modules, a feature that NGINX only recently added. NGINX is mainly used for <a href=\"http:\/\/www.hostingadvice.com\/reviews\/vps\/\" target=\"_blank\">VPS hosting<\/a>, <a href=\"http:\/\/www.hostingadvice.com\/reviews\/dedicated\/\" target=\"_blank\">dedicated hosting<\/a>, or cluster containers.<\/p>\n<p>High-traffic website ownerss that need to serve a lot of static content and\/or media streams will probably prefer NGINX (or use a combination of Apache and NGINX). In most other website use cases, either web server will do the job just fine. To get started with either web server, you\u2019ll need a solid Linux hosting provider. Luckily, our team compared the best providers and can point you in the right direction for Linux hosting for shared or virtual servers.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>By: Ryan Frankel Posted: May 9, 2016 &nbsp; TL; DR: We  <a href='https:\/\/www.icocean.com\/blog\/?p=4665' class='excerpt-more'>[&#8230;]<\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[3981],"tags":[],"class_list":["post-4665","post","type-post","status-publish","format-standard","hentry","category-nginx-","category-3981-id","post-seq-1","post-parity-odd","meta-position-corners","fix"],"amp_enabled":true,"_links":{"self":[{"href":"https:\/\/www.icocean.com\/blog\/index.php?rest_route=\/wp\/v2\/posts\/4665","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.icocean.com\/blog\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.icocean.com\/blog\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.icocean.com\/blog\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.icocean.com\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=4665"}],"version-history":[{"count":2,"href":"https:\/\/www.icocean.com\/blog\/index.php?rest_route=\/wp\/v2\/posts\/4665\/revisions"}],"predecessor-version":[{"id":4671,"href":"https:\/\/www.icocean.com\/blog\/index.php?rest_route=\/wp\/v2\/posts\/4665\/revisions\/4671"}],"wp:attachment":[{"href":"https:\/\/www.icocean.com\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=4665"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.icocean.com\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=4665"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.icocean.com\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=4665"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}