Redis install & configure for wordpress

Latest version 4.0
redis as server
Using Redis as an LRU cache
Installing from source & compile at server
sudo apt-get update
sudo apt install build-essential
cd /tmp
tar xzvf redis-stable.tar.gz &&  cd redis-stable
make && make install
cleaning temdirectory

working with redis configuration file

sudo mkdir /etc/redis &&  cp redis.conf /etc/redis/
sudo nano /etc/redis/redis.conf
maxmemory 128mb
maxmemory-policy allkeys-lru
supervised no (change)
supervised systemd
working directory
dir ./
change to
dir /var/lib/redis
Create Redis systemd Unit File
sudo nano /etc/systemd/system/redis.service
copy & paste the below code

Description=Redis In-Memory Data Store

ExecStart=/usr/local/bin/redis-server /etc/redis/redis.conf
ExecStop=/usr/local/bin/redis-cli shutdown


save the file by CTRL+X and type and hit enter.

Creating User /group /directories and permissions

sudo adduser –system –group –no-create-home redis &&  mkdir /var/lib/redis && chown redis:redis /var/lib/redis && chmod 770 /var/lib/redis


sudo systemctl start redis


sudo systemctl stop redis


sudo systemctl restart redis

Enable Redis on every Bootup

sudo systemctl enable redis
netstat -lntp to know all listening ports
# redis-cli>>ping
you will get pong
Redis configuring with PHP
install the Redis Object Cacheplugin.
why Redis among memcached and php apcu?

php 7 install redis extension

apt-get install php-redis
check redis module or not by typing
php -m | grep redis
PHP Warning: Module ‘redis’ already loaded in Unknown on line 0
supports php 7 then don’t go for manual installation.
memcached storage is low,
php acpu almost dead.
Installing from ubuntu repository
apt-get install redis
apt-get install php-redis
Quick & easy but not the latest version.

Enable Redis object cache in w3 Total cache

Performance (w3tc)>> General settings>> page cache>>

  1. Disc basic
  2. Disc enhance
  3. Php Apcu
  4. Redis  (it will available once you load redis PHP extension)
APcu vs memcached vs Redis
Does not share the cache with other servers but is faster (maybe)
single machine.
nano /etc/php/7.0/mods-available/apcu.ini
apc.shm_size = “40M”
nano /etc/php/7.0/mods-available/redis.ini
opache settings for wordpress
don’t disable timestamps. it caches all unnecessary php file from /wp-includes and wp-admin/
don’t set large amount memory.
validate settings should be low.
Comments (0)
Add Comment