WordPress and FastCGI Cache
Utilizing FastCGI Cache with your WordPress site helps speed up requests for your sites and provides users an improved user experience with decreased load times.
To turn on FastCGI, go to your site in Cleavr, click on FastCGI and then click enable if not already enabled.
This will provide the following abilities right off the bat:
Clicking this button will clear the cache for the site.
If FastCGI cache is enabled and you clear cache using the hook or the Cleavr WordPress plugin, please note that you may see in the NGINX error log a related event that is logged that is marked critical. This is due to NGINX not seeing the cache file when it is set to automatically clear the cache and as a result writes an error to the log. This error doesn't critically impact NGINX and can be ignored.
Clear Cache Trigger Hook
You can use this hook to programmatically clear the site's cache.
An additional use-case for this is to use it in conjunction with Cleavr's Clear Cache WordPress plugin.
The text area provides the default directives for FastCGI Cache. This is a starting point to provide some basic configurations that you can customize and add to for your specific needs.
Additionally, you may need to update some of the site's NGINX settings for FastCGI optimization which can be done in site > settings > NGINX Configs.
Cleavr stores site cache (
fastcgi_cache_path) in the following directory on your server:
You may need to supply this directory for certain WordPress NGINX Cache Plugins.
WordPress NGINX Cache Plugins
Cleavr Cache Clear
We created a variation of the popular NGINX Cache plugin that better works with Cleavr's setup and is something that we'll be expanding functionality for.
The plugin is called Cleavr Clear Cache and is available in the WordPress plugin library.
One of the key features is that it allows for clearing cache for sites assigned to server users in addition to the cleavr user.
You'll need to provide the Clear Cache Trigger Hook when setting up this plugin.
Several users in the Cleavr community have recommended NGINX Cache.
With this tool, you can clear cache with a click of a button from your WordPress admin section and even set it to auto-clear cache when content is changed.
As mentioned previously, there is a limitation with the plugin in that it only works for websites that are assigned to the 'cleavr' server user. The limitation is more so due to how NGINX creates cache files and assigns ownership.
You'll need to provide the path to the cache location (
/opt/cleavr/nginx/<site name>) when setting
up this plugin.
Inactive Cache Setting
If cache has not been accessed in 60 minutes, NGINX will automatically clear the cache.
This is a default setting in
fastcgi_cache_path /opt/cleavr/nginx/<site-name> levels=1:2 keys_zone=<site-name>:10m inactive=60m;
You can shorten or extend this time by SSH'ing into your server and updating
You can change the interval, for example:
10mfor 10 minutes
10hfor 10 hours
10dfor 10 days