In this video, we talk through how to set up caching on WP Alpha. WordPress needs page caching: without it, the server has to run PHP and a series of database lookups every time someone requests a page. With a cache in place, pages are built once, stored on the server and sent straight to the next visitor.
For most sites, we recommend using a caching and performance plugin like https://wprocketplugin.com or https://flyingpress.net but for more technical users or simple sites, our inbuilt Nginx caching works really well.
Ideally, use the Nginx helper plugin if you use this setup https://wordpress.org/plugins/nginx-helper.
Step by step
If you use WP Rocket or FlyingPress, you can skip these steps: install the plugin and configure it following its own instructions. The steps below are for the caching built into the hosting.
- Log in to the hosting console, open WordPress and find your site. Look for the Nginx caching section.
- Switch caching on with the toggle, then open its settings.
- Set the cache size to around half a gigabyte.
- Set the cache timeout, which is how long pages stay cached. One day is a good starting point. A site that rarely changes can use up to 7 days; a site that changes often, such as a WooCommerce store, might use about 12 hours.
- Under the locations where caching is disabled, add pages that must never be cached, such as cart, checkout, wishlist and my account. Add each one with and without the trailing slash. Keep the WordPress back end locations ticked.
- Leave the cookie settings at their defaults unless you know what you are doing. By default the cache is bypassed whenever WordPress sets a cookie, which is the safe behaviour.
- In WordPress, install the free Nginx Helper plugin and enable it. It lets WordPress purge the cache when a page is created or updated.
- Test a page with KeyCDN’s HTTP header checker and look for the
X-Cache-Statusheader. HIT means the server served the page from its cache. BYPASS or another value means the page was not cached.
Clearing or turning off the cache
The caching settings include an option to clear the cache, which does the same job as a purge from the Nginx Helper plugin. To turn caching off, switch the toggle off. In the video it is switched off in both places it appears, just to be safe.
Which option suits your site
Nginx caching is reliable for smaller sites that are mostly content. For WooCommerce or membership sites a plugin is usually the better choice, because plugins such as WooCommerce can talk to the caching plugin directly and the cookie settings above quickly become technical.
If you get stuck, our support team can help: log a ticket from the client area or start a live chat.
