Epidemiology & Technology

REDIS with WordPress

  • https://www.digitalocean.com/community/tutorials/how-to-install-and-secure-redis-on-ubuntu-18-04
  • https://www.combell.com/en/help/kb/how-to-implement-redis-in-wordpress/
  • https://blog.runcloud.io/redis-object-cache/#how-to-install-redis-object-cache-using-redis-object-cache-wordpress-plugin
  • https://wp-rocket.me/blog/redis-full-page-cache-vs-nginx-fastcgi/

 Steps

sudo apt-get install redis-server

openssl rand 60 | openssl base64 -A
SOMERANDOMTEXT

sudo nano /etc/redis/redis.conf

```
supervised systemd
bind 127.0.0.1 ::1
requirepass SOMERANDOMTEXT
maxmemory 256mb
maxmemory-policy allkeys-lru

# rename-command CONFIG ""
rename-command FLUSHDB ""
rename-command FLUSHALL ""
rename-command DEBUG ""
rename-command SHUTDOWN SHUTDOWN_MENOT
rename-command CONFIG ASC12_CONFIG

```
sudo systemctl restart redis.service
sudo netstat -lnp | grep redis


sudo apt-get install php7.4-redis
sudo service php7.4-fpm restart
Code language: PHP (php)

WordPress configuration

POSITIONING IS IMPORTANT. It should be just after DB_COLLATE line


sudo nano /var/www/html/wordpress/wp-config.php

sudo nano /var/www/html/wp-config.php


/** The Database Collate type. Don't change this if in doubt. */
define( 'DB_COLLATE', '' );
/**
* REDIS config
*/
define('WP_CACHE', true);
define('WP_REDIS_HOST', '127.0.0.1');
define('WP_REDIS_PORT', '6379');
define('WP_REDIS_PASSWORD', 'SOMERANDOMTEXT');
define('WP_REDIS_MAXTTL', '86400');
Code language: PHP (php)

 WORDPRESS PLUGINS

Install the following plugins: 

Related Posts