Caching Content on your WordPress VPS

April 27, 2016

If you still don’t think your WordPress site is fast enough, or you are expecting VERY high traffic for some reason, it’s time to start caching. Like with most things in life, there is an easy way and a hard way to enable caching on your WordPress VPS.

Simple Solution

The quickest way to get caching enabled on your site is to use Hyper Cache. This pretty much works out of the box, but you will need to add the line

define("WP_CACHE", true);

to your wp-config.php file, which you can do using another plugin like File Manager.

Hyper Cache Configuration

The aim of Hyper Cache is to be efficient but easy to configure. It has a simple configuration panel with preset values ready for your blog. You can tweak the configuration to improve even more the performances or to address specific needs. Check the official page here for more information. Test that everything works properly on your site before leaving this plugin enabled!

Advanced Solution

W3 Total Cache is one of the more popular solutions for advanced caching, and works very well with nginx (certain features). W3 Total Cache improves the user experience of your site by increasing server performance, reducing the download times and providing transparent content delivery network (CDN) integration.

wp-w3-general

Getting it to work correctly with other plugins like WooCommerce can be tricky, so be prepared to read lots of documentation!

Note: Even though it’s the best solution, W3 Total Cache still doesn’t fully work with PHP 7 (you will see errors when you enable this plugin). However, we really don’t think you need to use a caching plugin as your website will be quite fast already – it uses nginx and sits on a super fast Solid State Drive (SSD).

If you really, really still want a caching plugin, use W3 Total Cache but disable all settings except those shown below. Then look at your options for CDN (content delivery network) providers or check out CloudFlare.

Recommended Settings for W3TC

For reference, our own preferred setup on this website is as follows:

  • Page Cache = off
  • Minify = off
  • Database Cache = on (disk)
  • Object Cache = on (disk)
  • Browser Cache = off

These settings allow W3TC to work without error on PHP 7 and do not interfere with other plugins like WooCommerce.

Then we use CloudFlare to minify all the CSS, JS and HTML for the site…

Minify Settings in CloudFlare

and switch Rocket Loader to Automatic

Rocket Loader

CloudFlare also takes care of the Browser Caching for us 🙂