Quick Cache & Nginx

Quick Cache is one of my favourite WordPress cache plugins because it works very well without requiring any configuration and delivers a noticeable quickness with which the web pages are delivered.

You can check whether Quick Cache is working by seeing the “source” of the page. At the bottom, you will see

This Quick Cache file was built for ( vps2.me/quick-cache-nginx/ ) in 0.28908 seconds, on Jul 6th, 2012 at 6:48 pm UTC.
This Quick Cache file will automatically expire ( and be re-built automatically ) on Jul 6th, 2012 at 7:48 pm UTC
Quick Cache Is Fully Functional 🙂 … A Quick Cache file was just served for ( vps2.me/quick-cache-nginx/ ) in 0.00021 seconds, on Jul 6th, 2012 at 6:49 pm UTC.

When I was using apache2 as the webserver, there was no problem at all. However, when I shifted to Nginx, I noticed that while Quick Cache would cache the index page (the front page), the single page was never processed by Quick cache. Sometimes, even the front page was not being cached even though no errors were reported by the plugin.

I was so upset by this, that I was thinking of migrating back to Apache.

Well, there is a simple solution now for getting Quick Cache to work with Nginx that which is available in the form of the nginx Compatibility plugin. According to the developer, the plugin is required because:

When WordPress detects that mod_rewrite is not loaded (which is the case for nginx as it does not load any Apache modules) it falls back to PATHINFO permalinks in Permalink Settings page. nginx itself has built-in support for URL rewriting and does not need PATHINFO permalinks. Thus, when the plugin detects that nginx is used, it makes WordPress think that mod_rewrite is loaded and it is OK to use pretty permalinks.

When you install the nginx Compatibility plugin and activate it, it shows two options of PHP4 & PHP5 compatibility with PHP4 activated even if the server is running PHP5. According to the developerActually PHP4 version won’t do any harm – it is the same as PHP5 version but the code does not have any language constructs that are not supported by PHP 4“.

Anyway, it worked for me in the PHP4 version and when I disabled it and enabled the PHP4 version, that worked as well.

So, do give the nginx Compatibility plugin a look-in if you are having problems getting Quick Cache to work with nginx.

Update: I am running Quick Cache on this site without any problems. However, when I tried to duplicate this at my other sites, I didn’t have the same luck. So check the post on the DB Cache Reloaded Fix plugin which appears to work very well with nginx (tested with Centos & Ubuntu).

One thought on “Quick Cache & Nginx

  1. Wordpress Nginx Cache Plugin | vps2.me

    […] it has not been cached. One solution for this is the nginx Compatibility plugin which I explained here. I’ve got it working on this site without any problem. However, I’ve not had the same luck on […]

Leave a Reply

Your email address will not be published. Required fields are marked *