Hello, I have written a small tutorial to explain how to setup redis-server and use it as object cache backend for WordPress on a Plesk Onyx server.
To setup Redis, two solutions available : local install or inside a docker container
Solution 1) Local Installation of Redis-server ( debian 8 Jessie )
You can install redis-server easily with the package available on the
dotdeb.org repository.
I have create a simple bash script to install redis :
Code:
bash <(wget --no-check-certificate -O - https://git.virtubox.net/virtubox/plesk-script/raw/master/redis-cache.sh)
But you can install redis manually, by adding the main repository to your sources.list
Code:
echo 'deb http://packages.dotdeb.org jessie all' > /etc/apt/sources.list.d/dotdeb.list
wget https://www.dotdeb.org/dotdeb.gpg
apt-key add dotdeb.gpg
And install redis-server :
Code:
apt-get update && apt-get upgrade -y
apt-get install redis-server -y
Then start the redis-server service :
Code:
service redis-server start
Solution 2) Run Redis inside a docker container
You can create your container from the Plesk docker manager :
I have used the bitnami/redis image, and the following settings :
You can also create your container directly from the command line :
Code:
docker run \
-e REDIS_PASSWORD=redispassword \
-v /var/redis:/bitnami \
-p 6379:6379 \
bitnami/redis:latest
Configure Redis-object-cache plugin in WordPress
Our redis-server is now running properly, so you can install the plugin redis-object-cache using the wordpress plugin manager. Before enabling object-cache, you have to add following line in your wp-config.php file :
Code:
define( 'WP_CACHE_KEY_SALT', 'yoursitename:' );
It will add a prefix to all cache keys stored in redis, and allow you to use object-cache for multiple wordpress instances on the same server.
If you have set a password to secure redis, you will also have to add the following line in your wp-config.php file :
Code:
define( 'WP_REDIS_PASSWORD', 'redispassword' );
Then, you can enable object-cache in the plugin settings page :
Tutorial available on :
Improve WordPress loading speed with Redis on Plesk Onyx - VirtuBox
Feel free to tell me if you have any suggestion to improve my guide .