Client Area

 Client Area

Improve WordPress loading speed with Redis on Plesk Onyx

redis plesk wordpress

Sections

    Redis-server is a powerful keys storage solution, and with the WordPress plugin Redis-object-cache, we can improve WordPress loading speed and use Redis-server as persistent object-cache backend. But at first, we have to install redis-server.

    Install redis-server from packages repository

    You have the choice between installing Redis directly on your Plesk server, or running Redis inside a docker container.

    On debian 8 Jessie

    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
    
    apt-get update
    apt-get install redis-server -y
    service redis-server start
    

    On Ubuntu 16.04 LTS

    sudo add-apt-repository ppa:chris-lea/redis-server
    sudo apt-get update
    
    sudo apt-get install redis-server -y
    service redis-server start
    

    Running Redis with a docker container

    You can create your container from the Plesk docker manager :
    I have used the bitnami/redis image, and the following settings :

    bitnami redis container docker plesk onyx

    You can also create your container directly from the command line

    docker run \
    -e REDIS_PASSWORD=redispassword \
    -v /var/redis:/bitnami \
    -p 6379:6379 \
    bitnami/redis:latest
    

    Install Redis-object-cache 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 :

    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 :

    define( 'WP_REDIS_PASSWORD', 'redispassword' );
    

    Then, you can enable object-cache in the plugin settings page :

    redis object cache wordpress

    in Plesk

    Feedback