So that WordPress can use Redis, install and configure one of the specialized plugins:
To enable support
Redis in WordPress using the Redis Object Cache plugin, do the following:
-
-
Edit
config file site
wp-config.php
and add to its beginning (right after
<?php
) such lines (in the second line instead of
example
substitute
hosting account name, in which the site is located, in the third line instead of
example
substitute a unique prefix for storing data in Redis, which is important when using Redis for multiple sites):
define('WP_REDIS_SCHEME', 'unix');
define('WP_REDIS_PATH', '/home/example/.system/redis.sock');
define('WP_CACHE_KEY_SALT', 'example');
In the admin panel of the site, go to the section "
Settings → Redis" and press "
Enable Object Cache»:

If everything is in order, at the top of the section opposite “
Condition"Should display"
Connected»:

Check the site is working.
To enable support
Redis in WordPress using the W3 Total Cache plugin, do the following:
-
-
Go to the section "
Performance → General Settings»:

In the block "
Object Cache»:

Opposite "Object Cache"Check the box next to"Enabled».
Opposite "Object Cache Method»Select«Redis».
Save your changes.
Go to the section "
Performance → Object Cache»:

In the block "Advanced»:
Opposite "
Redis hostname:port / IP:port»Specify
/home/example/.system/redis.sock
(instead
example
substitute
hosting account namewhere the site is located) and click "
Test»:

If everything is in order, the green inscription “
Test passed»:

Save your changes.
Follow the same steps for "Page Cache"And"Database Cache».
Check the site is working.