install redis over ubuntu 14.04 & centos 7 for wordpress

ubuntu 14.04

1. sudo apt-get install redis-server php5-redis
2. Edit the file /etc/redis/redis.conf and add the following lines at the bottom:

sudo nano /etc/redis/redis.conf
Add these lines at the end of the file:

maxmemory 256mb
maxmemory-policy allkeys-lru

restart following
sudo service redis-server restart
sudo service php5-fpm restart

3. add one line as below on wp-config.php
define(‘WP_CACHE’, true);

centos7

1. yum install wget
2. wget http://dl.fedoraproject.org/pub/epel/7/x86_64/e/epel-release-7-5.noarch.rpm
3. sudo rpm -ivh epel-release-7-5.noarch.rpm
or
1.sudo yum -y update
2.sudo yum install redis -y
3.sudo systemctl start redis.service
4.sudo systemctl status redis.service
5.sudo nano /etc/redis.conf
tcp-keepalive 60
#bind 127.0.0.1
maxmemory-policy noeviction
appendonly yes
6.sudo systemctl restart redis.service
7. yum install redis php-pecl-redis
you can redis from phpinfo function
8. add one line as below on wp-config.php
define(‘WP_CACHE’, true);

install w3c cache. it has option to enabled db cache with redis or install from below url

1. Download the PHP script:

wget https://assets.digitalocean.com/articles/wordpress_redis/object-cache.php
Move the file to the /wp-content directory of your WordPress installation:

sudo mv object-cache.php /var/www/html/wp-content/

Leave a Reply

Your email address will not be published. Required fields are marked *