Configure Redis for WordPress

apt-get install redis-server php-dev

vi /etc/redis/redis.conf
# Enable Unix sockets by uncommenting:
unixsocket /var/run/redis/redis.sock
unixsocketperm 777

# Add to bottom:
maxmemory 256mb
maxmemory-policy allkeys-lru

pecl install redis
vi /etc/php/7.0/fpm/conf.d/10-redis.ini
# Add:
extension=redis.so
service redis start

Install: https://wordpress.org/plugins/redis-cache/

Add to wp-config.php:
define('WP_REDIS_SCHEME', 'unix');
define('WP_REDIS_PATH', '/var/run/redis/redis.sock');
define('WP_REDIS_DATABASE', '1');
define('WP_CACHE_KEY_SALT', 'domein.nl');

wp plugin activate redis-cache
wp redis status

# Test wp-admin access

# If you get: Sorry, you are not allowed to access this page, then flush the Redis database by running:
service redis-server restart
redis-cli FLUSHALL

# Check cache
redis-cli monitor
Share on facebook
Share on google
Share on twitter
Share on linkedin
Share on whatsapp