How to Configure WordPress with Redis (From the Command Line)

To enable Redis, you’ll have to have Redis installed on your site. You can request this from Servebolt support. There are multiple plugins available to enable Redis for WordPress. This example uses the plugin Redis Cache which has 60K installs and is actively maintained.

Time needed: 5 minutes

After you have received confirmation from our Support team that Redis is enabled for your site, you can enable it by following this recipe.

  1. Add the configuration to wp-config.php

    define( 'WP_REDIS_PATH', '/run/redis/redis.sock' );
    define( 'WP_REDIS_SCHEME', 'unix' );

    Please note that if you are running WordPress out of some other directory or subfolder, you’ll have make the path to the socket relative to your applications directory.

  2. Install the Redis Cache plugin

    wp plugin install redis-cache --activate

  3. Enable Redis in the plugin using WP-CLI

    wp redis enable

  4. Verify that Redis is working

    You can verify the Redis connection from the command line by running:
    wp redis status|grep -i status

    If Redis is connected and working correctly, the output should show:
    Status: Connected

    You can also run the following command to view the full Redis status and configuration:
    wp redis status

    Once Redis is connected, browse a few pages on your site to populate the object cache.


And as always, should you have any additional questions please don’t hesitate to contact our support chat at servebolt.com!