How to install redis on plesk and make your websites fast

How to install redis on plesk and make your websites fast

Redis is a cache open source, memory structure store, mainly used on websites as cache system. With Redis installed on a VPS server with Plesk, can improve the speed of websites developed with WordPress, Woocommerce, Magento, Joomla, Prestahop or Opencart.

The most popular website platform, WordPress, has several plugins like “W3″or “Redis-object-cache” to integrate with Redis cache server. In this tutorial we will install Redis cache server on a dedicaded server or VPS server with Plesk already installed.
On the next tutorial we will integrate Redis with a WordPress website under Plesk and we will do measurements in speed, Before redis and after.

As of now Redis Server is currently not supported in Plesk panel. Which means we can’t directly install Redis server as a plugin on Plesk portal. We can install it via Docker, like the tutorial ‘install Redis in Docker Plesk’ or we need to do manually.

We strongly recommed to install Redis manually on Plesk VPS server, Your server must have plenty of Ram, fast I/O and SSD disk like our VPS servers.

For the following installation you can use Centos 7.7 or Centos 8 with Plesk already installed, if you do not know how to install plesk, please read the tutorial ‘Install Plesk on Centos the correct way’

 

So, let start. Connect via SSH and activate epel repository on your Centos server

1
2
yum install epel-release
yum install redis -y

 

Enable overcommit memory and hugepage with following 2 commands

1
2
echo "vm.overcommit_memory = 1" >> /etc/sysctl.conf && sysctl -p
echo never > /sys/kernel/mm/transparent_hugepage/enabled

 

To make Redis work properly with your websites we need to install php-redis module

1
yum install php-redis

 

Now, it is time to start Redis service on server and make tha service to start automatically on each reboot

1
2
3
systemctl start redis.service
systemctl enable redis
systemctl status redis.service

 

So, if status shows “active” then Redis is installed properly on server. Now we need to edit redis.conf file

1
vi /etc/redis.conf

 

Please change bind, protected-mode, requirepass and memory policy exactly like tutorial below

1
2
3
4
5
bind 0.0.0.0
protected-mode no
requirepass A_STRONG_PASSWORD
maxmemory-policy allkeys-lru
systemctl restart redis.service

 

Restart Redis service with following commands and check if the port is up and running

1
2
3
systemctl start redis.service
netstat|grep 6379
ss -an|grep 6379

 

Now, login to Redis cli

1
2
redis-cli -h 127.0.0.1 ping AUTH
redis-cli -h 127.0.0.1 -p 6379

 

So, Redis is ready to accept any connections, main redis log file you can find it here

1
/var/log/redis/redis.log

 

Redis installation is very easy process and some times it is not worth using docker on Plesk. With commands above, Redis will installed and configured propelry on the server.

On next 2 tutorials we will connect a wordpress site on Plesk redis step by step. Also we will know the way to use Redis as standalone server for any website hosted every where. Please send us a message if you find troubles on Redis installation on your server, we will feel happy to help and support you.