NGINX configured with FastCGI caching

December 12, 2017

#Caching #FastCGI Caching #NGINX

“Nginx includes a FastCGI module which has directives for caching dynamic content that are served from the PHP backend. Setting this up removes 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 the request method, URL, cookies, or any other server variable.”

How to Setup FastCGI Caching with Nginx on your VPS – DigitalOcean

So it turned out that there is just a little bit more involved when multiple domains are hosted on the same server – in particular the fastcgi_cache_key directive will not want to be duplicated across multiple Virtual Hosts. The Virtual Host files are read in alphabetical order – so it can either be included in the first or else moved to nginx.conf.

It seems to work very well. Here is hosted on a $5 per month droplet @ DigitalOcean (referral link) handling 10,000 hits over 1 minute tested using Granted this is not a definitive test of how the server would necessarily respond under real world conditions. But it’s a great start – no errors, no timeouts. View the report in more detail here at
10,000 hits over 1 minute

Show All Posts