Command Palette
Search for a command to run...

With WHM (Web Host Manager) access, managing server-wide configurations becomes straightforward. This guide will walk you through installing and configuring Redis on your server using WHM, specifically for a WordPress site. Additionally, we will address a common error: “Redis is unreachable: Connection refused [tcp://127.0.0.1:6379].”
![Redis is unreachable: Connection refused [tcp://127.0.0.1:6379]](http://blog.sayeedjoy.com/wp-content/uploads/2024/06/scr-20240201-ohcr-667a208b5dcf3-1024x635.webp)
Redis is an open-source, in-memory data structure store that is used as a database, cache, and message broker. It supports data structures such as strings, hashes, lists, sets, and more. In a WordPress context, Redis is often used to improve site performance by caching database queries and reducing load times.
To begin, you’ll need root SSH access to your server. Open your terminal and connect to your server via SSH.
Depending on your server’s OS, use the appropriate command to install Redis:
yum install redis
dnf install redis
Once Redis is installed, ensure it is running and set to start on boot:
systemctl start redis
systemctl enable redis
To confirm that Redis is working correctly, use the Redis command-line interface:
redis-cli ping

If Redis is running, you should receive a “PONG” response.
To configure Redis for PHP applications via cPanel:
To use Redis with WordPress:
127.0.0.1 on port 6379.This error indicates that the Redis service is either not running or not accessible at the specified address. Here are steps to troubleshoot and fix this issue:
Check the status of the Redis service:
systemctl status redis
If the service is not running, start it:
systemctl start redis
Ensure Redis is configured to listen on 127.0.0.1 and port 6379. Edit the Redis configuration file (redis.conf):
redis.conf: nano /etc/redis/redis.conf
Ensure the following lines are present and correct:
bind 127.0.0.1
port 6379
After making changes, restart Redis:
systemctl restart redis
Ensure that the firewall is not blocking Redis connections on port 6379:
firewall-cmd --permanent --add-port=6379/tcp
firewall-cmd --reload
Use the Redis CLI to test the connection:
redis-cli -h 127.0.0.1 -p 6379 ping

If you receive a “PONG” response, the connection is successful.
Edit the Redis configuration file (redis.conf), typically located in /etc/redis/.
requirepass yourstrongpassword
Adjust the maxmemory setting according to your server’s RAM to optimize performance:
redis.conf: maxmemory 256mb # Example setting
Regularly check Redis logs for errors or important messages. Logs are usually found in:
/var/log/redis/redis.log
By following this guide, you can successfully install, configure, and troubleshoot Redis on your server using WHM. Redis can significantly enhance the performance of your WordPress site by providing efficient caching and fast data retrieval. Addressing common errors like “Redis is unreachable: Connection refused [tcp://127.0.0.1:6379]” ensures that your Redis setup runs smoothly. Regularly monitor and optimize your Redis configuration to maintain optimal performance and security. If you encounter any issues beyond your control, don’t hesitate to reach out to your hosting provider’s support team for assistance. With proper setup and maintenance, Redis can be a powerful tool in your web hosting environment, offering speed and reliability for your applications.