Skip to content

Trellis Docs

FastCGI Caching

You can enable caching for your site by changing the cache settings under each site key. Using caching provides substantial speed improvement once pages are cached. The full settings looks like this:

The duration parameter control how long your pages will stay in the cache. You should generally keep this value low (the default is 30 seconds), unless your content doesn't change frequently. Lowering the duration to 1s will make the cache more like a DDOS protection; meaning that if you have a sudden spike of traffic, only one request will hit the back-end per second instead of the full load. The whole setup is "micro-cache" oriented, so there is no means of flushing the cache.

The skip_cache_uri is a regex that will be used to tell Nginx not cache pages matching it. Use it if you have sections of your site that you don't want cached (like shopping carts). Override the global nginx_skip_cache_uri in group_vars/all/main.yml or override skip_cache_uri under cache to vary it per WordPress site. The default value is shown above.

The skip_cache_cookie is a regex that will disable the cache when a cookie match it. Useful for disabling the cache for certain users.

Already cached content will continue being served if your back-end (PHP-FPM) goes down.

Example cache configurations

WooCommerce

Disable the cache for /store/, /cart/, /my-account/, /checkout/, /addons/, and when items are in the cart:

Easy Digital Downloads

Disable the cache for /checkout/ and when items are in the cart:

Contributors

Getting Started