in DevOps


Redis is an open source, in-memory, key value data store, used as database, cache and message broker. One of the easy way to configure Redis with WordPress + Nginx, is to use EasyEngine . But below lets discuss about geek part and configure redis object + page caching manually  on server.

Step 1: Install Redis-Server

add-apt-repository ppa:chris-lea/redis-server
sudo apt-get update
sudo apt-get install redis-server php5-redis

Step 2: Test Redis  Setup

[email protected]:~# redis-cli ping

This should print a `PONG` as the response.

Step 3: Configure Redis configuration

sudo nano /etc/redis/redis.conf

Uncomment or Add following line at top

# By default Redis listens for connections from all the network interfaces
# available on the server. It is possible to listen to just one or multiple
# interfaces using the "bind" configuration directive, followed by one or
# more IP addresses.
# Examples:
# bind


Add these lines at the end of the file:

maxmemory 256mb
maxmemory-policy volatile-lru

Step 4 : Restart redis server

sudo service redis-server restart

Step 5 : Enable Cache Settings in wp-config.php

Next, edit the wp-config.php file to add a cache key salt with the name of your site.

nano /var/www/

Add this line at the end of the  * Authentication Unique Keys and Salts. section:

define('WP_CACHE_KEY_SALT', '');

You can use your domain name or another string as the salt.

Step 6: Restart web services

sudo service nginx restart
sudo service php5-fpm restart

Step 7: Install & configure Object Cache plugin

Install and Activate below wordpress plugin for object cache:

Monitor Redis with redis-cli

To monitor Redis, use the redis-cli command like so:

redis-cli monitor

When you run this command, you will see the real-time output of Redis serving cached queries. If you don’t see anything, visit your website and reload a page.

Clear all Redis cache

The Redis cache can be purged by using the flushall command from the Redis command line:

redis-cli flushall