August 16 2022

The problems of NGINX FastCGI Cache in the free version.

There are some details that are good to know given the widespread use of FastCGI Cache that could compromise the health of your site.

NGINX Fast CGI Cache

We all know that application and website performance are critical to their success. The process for improving application or website performance, however, is not always clear. Code quality and infrastructure are obviously critical, but in many cases you can make significant improvements to the end-user experience of your application by focusing on some basic application delivery techniques. One such example is the implementation and optimization of caching in the application stack. This blog post covers techniques that can help both novice and advanced users get better performance from using the content caching features included in NGINX and NGINX Plus.


A content cache sits between a client and an "origin server" and saves copies of all content it sees. If a client requests cached content, it returns the content directly without contacting the origin server. This improves performance as the content cache is closer to the client and uses application servers more efficiently because they don't have to do the page generation work from scratch every time.

There are potentially multiple caches between the web browser and the application server: the client browser cache, intermediate caches, content delivery networks (CDNs), and the load balancer or reverse proxy that sits in front of the servers of applications. Caching, even at the reverse proxy / load balancer level, can dramatically improve performance.


For example, last week I took on the task of optimizing the performance of a website that was loading slowly. One of the first things I noticed was that it took more than 1 second to generate the main home page. After some debugging, I found that because the page was marked as non-cacheable, it was dynamically generated in response to each request. The page itself didn't change very often and wasn't customized, so it wasn't necessary. As an experiment, I marked the home page to be cached for 5 seconds by the load balancer and the fact alone resulted in a noticeable improvement. The time for the first byte dropped to a few milliseconds and the page loaded visibly faster.

We talked a lot about NGINX Webserver and how we prefer it for performance reasons to the more famous Apache.

However, we have talked little about FastCGI Cache, using Varnish Cache in the company for all high performance customers.

However, we are witnessing an evolution of many hosting providers who are proposing FastCGI Cache as a Full Page Cache solution for the NGINX webserver.

We will not be here to explain what a FPC (Full Page Cache ed) is, having already done it on several occasions on our blog, but we want to get right into the matter by talking about FastCGI Cache which at first glance may seem like a very caching solution. easier than enterprise-specific tools like Varnish Cache.

What is Nginx FastCGI Cache?

Before we talk about Nginx FastCGI Cache, let's talk about how your website works.

  1. When a user visits your WordPress page, the web browser sends an HTTP / HTTPS request to Nginx.
  2. Nginx passes the request to PHP-FPM and Nginx will capture all PHP codes when it tries to grab the page.
  3. PHP-FPM processes the page and queries the MariaDB / MySQL database to retrieve the page.
  4. PHP-FPM sends the generated “static” HTML page to Nginx.
  5. Nginx sends the generated HTML page to the web browser for the user.

NGINX includes a FastCGI module which has directives for caching dynamic content served by the PHP backend. The setting eliminates the need for additional page caching solutions like reverse proxies (think Varnish) or application-specific plugins. Content can also be excluded from caching based on request method, URL, cookies, or any other server variable.

When using Nginx FastCGI , this built-in Nginx module will sit between Nginx and PHP-FPM and is capable of generating a cached HTML page from PHP-FPM.

When another user visits the same WordPress page, your website will no longer perform the same PHP and database requests because the page is already cached and served by FastCGI.

As a result, your server response time will be much faster after the initial load.

Your PHP-FPM and MariaDB / MySQL load will be reduced.

Your server's CPU resource usage will be lower.

And finally, your server can handle more traffic with the same server specifications when using Nginx FastCGI Cache, ultimately allowing you to maintain a more affordable server without having to scale further.

The main problem of NGINX FastCGI Cache in the free version.

It must be said and remembered that NGINX has two distribution models, the Free version that everyone knows and we also use and the Plus version called NGINX Plus or NGINX + which is the paid commercial version.

The main and most important difference between the two versions for what concerns the FastCGI cache is that the functionality of PURGE ALL in the free version is missing by default.

In fact, it may happen that you need to clear all the cache in some specific configurations, let's imagine a blog that has the links of the last 5 news items in the footer and when writing a new news you have to clear all the cache of the entire site.

While with Varnish it is enough to send a BAN / or a PURGE ALL to clean the entire cache of the site with the same speed as performing a deletion operation on the Filesystem (perhaps less than a second), with NGINX FastCGI Cache in the Free version, you will need to recall one by one at the application level all the URLs of your site, taking at least 1 hour on a site with 5000 pages.

Obviously, to solve this problem, third-party modules for NGINX have been created that allow you to introduce the functionality of PURGE ALL such as, for example, ngx_cache_purge which you can find at this link:

In short, if you don't have broad shoulders to install a Caching Enterprise system such as Varnish, you can simply opt for the Free version by adding this module.




Do you have doubts? Don't know where to start? Contact us!

We have all the answers to your questions to help you make the right choice.

Chat with us

Chat directly with our presales support.


Contact us by phone during office hours 9:30 - 19:30

Contact us online

Open a request directly in the contact area.


Managed Server Srl is a leading Italian player in providing advanced GNU/Linux system solutions oriented towards high performance. With a low-cost and predictable subscription model, we ensure that our customers have access to advanced technologies in hosting, dedicated servers and cloud services. In addition to this, we offer systems consultancy on Linux systems and specialized maintenance in DBMS, IT Security, Cloud and much more. We stand out for our expertise in hosting leading Open Source CMS such as WordPress, WooCommerce, Drupal, Prestashop, Joomla, OpenCart and Magento, supported by a high-level support and consultancy service suitable for Public Administration, SMEs and any size.

Red Hat, Inc. owns the rights to Red Hat®, RHEL®, RedHat Linux®, and CentOS®; AlmaLinux™ is a trademark of AlmaLinux OS Foundation; Rocky Linux® is a registered trademark of the Rocky Linux Foundation; SUSE® is a registered trademark of SUSE LLC; Canonical Ltd. owns the rights to Ubuntu®; Software in the Public Interest, Inc. holds the rights to Debian®; Linus Torvalds holds the rights to Linux®; FreeBSD® is a registered trademark of The FreeBSD Foundation; NetBSD® is a registered trademark of The NetBSD Foundation; OpenBSD® is a registered trademark of Theo de Raadt. Oracle Corporation owns the rights to Oracle®, MySQL®, and MyRocks®; Percona® is a registered trademark of Percona LLC; MariaDB® is a registered trademark of MariaDB Corporation Ab; REDIS® is a registered trademark of Redis Labs Ltd. F5 Networks, Inc. owns the rights to NGINX® and NGINX Plus®; Varnish® is a registered trademark of Varnish Software AB. Adobe Inc. holds the rights to Magento®; PrestaShop® is a registered trademark of PrestaShop SA; OpenCart® is a registered trademark of OpenCart Limited. Automattic Inc. owns the rights to WordPress®, WooCommerce®, and JetPack®; Open Source Matters, Inc. owns the rights to Joomla®; Dries Buytaert holds the rights to Drupal®. Amazon Web Services, Inc. holds the rights to AWS®; Google LLC holds the rights to Google Cloud™ and Chrome™; Microsoft Corporation holds the rights to Microsoft®, Azure®, and Internet Explorer®; Mozilla Foundation owns the rights to Firefox®. Apache® is a registered trademark of The Apache Software Foundation; PHP® is a registered trademark of the PHP Group. CloudFlare® is a registered trademark of Cloudflare, Inc.; NETSCOUT® is a registered trademark of NETSCOUT Systems Inc.; ElasticSearch®, LogStash®, and Kibana® are registered trademarks of Elastic NV Hetzner Online GmbH owns the rights to Hetzner®; OVHcloud is a registered trademark of OVH Groupe SAS; cPanel®, LLC owns the rights to cPanel®; Plesk® is a registered trademark of Plesk International GmbH; Facebook, Inc. owns the rights to Facebook®. This site is not affiliated, sponsored or otherwise associated with any of the entities mentioned above and does not represent any of these entities in any way. All rights to the brands and product names mentioned are the property of their respective copyright holders. Any other trademarks mentioned belong to their registrants. MANAGED SERVER® is a trademark registered at European level by MANAGED SERVER SRL, Via Enzo Ferrari, 9, 62012 Civitanova Marche (MC), Italy.


Would you like to see how your WooCommerce runs on our systems without having to migrate anything? 

Enter the address of your WooCommerce site and you will get a navigable demonstration, without having to do absolutely anything and completely free.

No thanks, my customers prefer the slow site.
Back to top