Setting up Redis object cache for WordPress

wordpressperformanceredishosting

Redis can significantly reduce database load on busy WordPress sites.

Prerequisites

Install

sudo apt install -y redis-server

Enable

sudo systemctl enable redis-server

sudo systemctl start redis-server

WordPress (drop-in plugin approach)

Common practice is to use a plugin such as Redis Object Cache and enable it in WordPress.

Configure WordPress

In /var/www/<site-root>/wp-config.php:

define('WP_REDIS_HOST', '127.0.0.1');

Use a unique prefix:

define('WP_REDIS_PREFIX', '{site_slug}_');

Quick check