• Please be aware: Kaspersky Anti-Virus has been deprecated
    With the upgrade to Plesk Obsidian 18.0.64, "Kaspersky Anti-Virus for Servers" will be automatically removed from the servers it is installed on. We recommend that you migrate to Sophos Anti-Virus for Servers.
  • The Horde webmail has been deprecated. Its complete removal is scheduled for April 2025. For details and recommended actions, see the Feature and Deprecation Plan.
  • We’re working on enhancing the Monitoring feature in Plesk, and we could really use your expertise! If you’re open to sharing your experiences with server and website monitoring or providing feedback, we’d love to have a one-hour online meeting with you.

Input How to setup redis and use it as object-cache backend for WordPress

virtubox

Regular Pleskian
Plesk Guru
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 :

Screenshot_98.png


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 .
 
Feel free to tell me if you have any suggestion to improve my guide .
Thank you very much for your guide!
But note, that we have special Article section of our community forum for such kind of guides/instructions/etc - https://talk.plesk.com/articles/
BTW, your "Docker based" redis cache solution looks like a great addition to my "standalone" redis cache solution - https://talk.plesk.com/articles/plesk-php7-1-nginx-redis-cache-wordpress-crazy-acceleration.13/ :)
 
Thank you very much for your guide!
But note, that we have special Article section of our community forum for such kind of guides/instructions/etc - https://talk.plesk.com/articles/
BTW, your "Docker based" redis cache solution looks like a great addition to my "standalone" redis cache solution - https://talk.plesk.com/articles/plesk-php7-1-nginx-redis-cache-wordpress-crazy-acceleration.13/ :)

Thanks @IgorG . Docker make the redis deployment easier and compatible with any linux distribution. I haven't tried with Centos, but on Ubuntu 16.04 LTS, redis -server packages are pretty outdated (v3.0.6) on official repo. So it require to build redis from source with each new release.

Should I post my tutorial in the article section and ask to remove this thread ?
 

Thank you. I will add configuration steps for Centos and Ubuntu . I have also noticed the plugin redis-object-cache used in my tutorial is forked from Eric Mann’s and Erick Hitter’s plugin, used in your article.
It include some new features, including support of Predis or PhpRedis (PECL). And ability to use replication and clustering.
 
nice, is it possible to install it on centos 7? between redis and memcache which is recommended?
 
Thank you very much for your guide!
But note, that we have special Article section of our community forum for such kind of guides/instructions/etc - Plesk Forum
BTW, your "Docker based" redis cache solution looks like a great addition to my "standalone" redis cache solution - Plesk Forum :)
can you please update the link...it doesn't work anymore
 

Compilation isn't needed anymore on Ubuntu 16.04 LTS, since the last redis-server release is available from ubuntu packages repositories.
You can also add in your article the following commands after the installation :

Allow memory overcommit :
Code:
echo "vm.overcommit_memory = 1" >>  /etc/sysctl.conf  && sysctl  -p
Disable transparant_hugepage :
Code:
echo never > /sys/kernel/mm/transparent_hugepage/enabled
 
You can also add in your article the following commands after the installation
Yes, thank you! Good point and I have updated instruction for common cases. But unfortunately it doesn't work on my test Virtuozzo VPS due to kernel limitations :)
 
I am getting following error.

An external object cache is in use so Transient Cleaner is not required. Please disable the plugin.

any help will be appreciated

Regards
 
I am getting following error.

An external object cache is in use so Transient Cleaner is not required. Please disable the plugin.

any help will be appreciated

Regards

Hello,

it seems there is another caching plugin on your wordpress instance. If there isn't any other cache, take a look in the wp-content folder and make sure there isn't files like advanced-cache.php.
 
Back
Top