📑 Daftar Isi
- What Is Redis and Why Do So Many NOC Engineers Rely On It?
- Redis vs Memcached: Why Redis Usually Wins on cPanel
- Why Redis Matters for Your cPanel Websites
- 1. Dramatic Website Speed Improvement
- 2. Reduced MySQL/MariaDB Load
- 3. Faster Session Management
- 4. Real-time Features
- 5. Queue & Job Management
- How to Install Redis on cPanel/WHM (Step by Step)
- Step 1: Install Redis PHP Extension via EasyApache 4
- Step 2: Install Redis Server via Terminal
- Step 3: Verify Redis Is Working
- Step 4: Configure Redis for Production
- Configuring PHP on cPanel to Use Redis
- Enabling Redis Object Cache in WordPress
- Troubleshooting: Common Redis Issues on cPanel
- Best Practices for Production Redis on cPanel
- 1. Always Use a Strong Password
- 2. Set maxmemory Based on Your Needs
- 3. Monitor Regularly
- 4. Backup dump.rdb Automatically
- 5. Restart Redis Periodically
- FAQ: Frequently Asked Questions
- Related Articles
- Conclusion
I remember handling a client complaint about their website being painfully slow. “The site feels like it takes forever to load, but I already upgraded my hosting plan!” The server specs looked fine — NVMe SSD, 16GB RAM, no CPU bottleneck. After digging deeper, the issue wasn’t server resources at all. It was the way the website handled data. Every single page load triggered dozens of database queries, most of which returned the same results over and over. I recommended installing Redis on their cPanel server, and within 30 minutes the difference was night and day. The client couldn’t believe it: “All I needed was one service installed?”
That’s the thing about Redis — most people either don’t know it exists or assume it’s only for enterprise-level applications. In reality, if you’re running any kind of website on cPanel — WordPress, Laravel, Joomla, or custom apps — Redis can completely change the performance game.
Think of it like cooking in your kitchen. Every time you need a spice, you run to the store, grab it, come back, and continue cooking. Tedious, right? Now imagine having a spice rack right next to your stove with everything you use regularly. That’s Redis for your server. Instead of running to the database (the store) every time you need the same piece of data, Redis keeps frequently accessed data in memory — ready to grab instantly.
What Is Redis and Why Do So Many NOC Engineers Rely On It?
Redis (Remote Dictionary Server) is an in-memory data structure store. In plain English: it’s a system that keeps data in RAM rather than on disk. Because it uses RAM for storage, data access can be up to 100,000 times faster than reading from a hard drive.
Imagine you have a filing cabinet at work. Every time you need a document, you walk down to the basement archive, pull out a box, and search through it one by one. Slow, right? But if the documents you use most often are already on your desk, you just grab and read. That’s the core philosophy behind Redis.
Redis isn’t just a “cache” — it comes with features that set it apart from simpler caching solutions like APCu or Memcached:
- Rich data structures: Strings, Lists, Sets, Sorted Sets, Hashes, Streams, and more. You can store data in the most efficient format for your specific use case.
- Persistence: Unlike Memcached (where data disappears after a restart), Redis can persist data to disk via RDB snapshots or AOF logs.
- Pub/Sub messaging: Redis can act as a message broker — perfect for real-time features like live notifications or chat systems.
- Lua scripting: Run custom scripts directly on the Redis server for complex operations.
- Replication & clustering: Built-in high availability for production environments.
In the cPanel/WHM context, Redis is most commonly used for object caching — especially for applications like WordPress (via the Redis Object Cache plugin), Laravel, Joomla, and similar platforms. They store the results of database queries in Redis, so the same page doesn’t need to be recalculated on every request.
Redis vs Memcached: Why Redis Usually Wins on cPanel
This comes up all the time among NOC engineers and sysadmins. The short answer: it depends on your use case. But for most cPanel deployments, Redis is the stronger choice.
| Feature | Redis | Memcached |
|---|---|---|
| Data Structures | String, List, Set, Sorted Set, Hash, Stream | String only |
| Persistence | Yes (RDB & AOF) | No |
| Replication | Yes (master-slave) | No |
| Pub/Sub | Yes | No |
| Max Memory | Up to available RAM | Default 64MB per slab |
| Thread Model | Single-threaded (but very fast) | Multi-threaded |
| Primary Use Case | Caching, sessions, real-time apps, queues | Simple caching only |
| cPanel Support | Native via EasyApache 4 | Native via EasyApache 4 |
From my experience, Redis is far more flexible for WordPress hosting on cPanel. You can use it for object caching, page caching, and even session handling. Memcached is lighter weight, but for serious caching needs, Redis is the way to go.
Why Redis Matters for Your cPanel Websites
Let’s talk about the concrete benefits. Why should you bother installing Redis on your cPanel server?
1. Dramatic Website Speed Improvement
This is the most obvious benefit. With Redis, heavy database queries — like those needed to render articles, product listings, or comment threads — don’t need to be recalculated every time. The results are stored in Redis, and pages can be rendered in milliseconds.
I once handled an e-commerce website where page load times exceeded 4 seconds. After installing Redis and configuring the Redis Object Cache plugin in WooCommerce, load times dropped below 1.2 seconds. That’s more than a 70% reduction — without upgrading any hardware.
2. Reduced MySQL/MariaDB Load
Every query that Redis can cache is one less query MySQL has to execute. On VPS or dedicated servers hosting multiple websites, this is critical. You can see MySQL CPU usage drop by 40-60% after enabling Redis caching.
3. Faster Session Management
PHP sessions are typically stored on the filesystem. With Redis, sessions live in memory — access is faster, and for sites with high concurrent user counts, this eliminates file locking issues entirely.
4. Real-time Features
If your site needs real-time functionality — live chat, push notifications, or monitoring dashboards — Redis Pub/Sub can serve as the backbone. While this is less common in shared hosting, it’s incredibly powerful on VPS and dedicated servers.
5. Queue & Job Management
If you’re running Laravel or any framework that needs job queues (email bulk sending, image processing, report generation), Redis can serve as the queue driver. Background processes become more reliable and performant.
How to Install Redis on cPanel/WHM (Step by Step)
Now for the practical part. You need WHM (Web Host Manager) access to install Redis this way. Make sure you’re logged in as root or a user with WHM privileges.
Step 1: Install Redis PHP Extension via EasyApache 4
Redis is available in the EasyApache 4 repository, so no manual compilation is needed.
- Login to WHM (typically at
https://server-ip:2087) - Navigate to Software → EasyApache 4
- Click the Customize tab → select PHP Extensions
- In the search box, type
redis - Check
php-redisfor the PHP version you’re using (e.g., php8.1-redis, php8.2-redis) - Click Review → verify php-redis appears in the list
- Click Provision to start the installation
This process typically takes 2-5 minutes depending on your server speed. Don’t close your browser during installation.
Step 2: Install Redis Server via Terminal
EasyApache 4 only installs the PHP extension. The Redis server itself needs to be installed separately via terminal.
# For CentOS/RHEL/AlmaLinux/RockyLinux
yum install redis -y
# For Ubuntu/Debian
apt-get install redis-server -y
After installation, start and enable the Redis service:
# CentOS/RHEL
systemctl start redis
systemctl enable redis
# Check status
systemctl status redis
Expected output if Redis is running correctly:
● redis.service - Redis In-Memory Data Store
Loaded: loaded (/usr/lib/systemd/system/redis.service; enabled; vendor preset: disabled)
Active: active (running) since Mon 2026-07-26 10:15:32 UTC; 5s ago
Docs: man:redis-server(1)
Process: 12345 ExecStart=/usr/bin/redis-server /etc/redis/redis.conf (code=exited, status=0/SUCCESS)
Main PID: 12346 (redis-server)
CGroup: /system.slice/redis.service
└─12346 /usr/bin/redis-server *:6379
If the status shows active (running), Redis server is up and running. If you see errors, check the troubleshooting section below.
Step 3: Verify Redis Is Working
# Test Redis connection
redis-cli ping
# Expected output:
PONG
If the output is PONG, congratulations — Redis is running perfectly on your server.
Step 4: Configure Redis for Production
Don’t use the default configuration for production. Edit the Redis config file:
nano /etc/redis/redis.conf
Key settings you need to change:
| Parameter | Default | Recommended | Notes |
|---|---|---|---|
bind |
127.0.0.1 ::1 | 127.0.0.1 | Only listen on localhost — NEVER bind to 0.0.0.0 |
port |
6379 | 6379 | Default is fine if bound to localhost |
requirepass |
# (no password) | your_strong_password | MANDATORY for security |
maxmemory |
# (unlimited) | 256mb (or 25% of RAM) | Cap Redis memory usage |
maxmemory-policy |
noeviction | allkeys-lru | Auto-evict least recently used keys when memory is full |
protected-mode |
yes | yes | Keep enabled |
After editing, restart Redis:
systemctl restart redis
Verify the password works:
redis-cli -a 'your_strong_password' ping
# Expected output:
PONG
Configuring PHP on cPanel to Use Redis
After Redis server is running, you need to make sure the PHP installation on cPanel can connect to Redis. Here’s how:
Step 1: Verify PHP Redis Extension Is Active
Login to cPanel user → Select PHP Version (or via MultiPHP Manager in WHM). Make sure the redis extension is enabled.
Alternatively, create a PHP info file:
<?php
phpinfo();
?>
Open this file in a browser and search for “redis” — if the section exists, the extension is active.
Step 2: Test Connection from PHP
<?php
$redis = new Redis();
$redis->connect('127.0.0.1', 6379);
$redis->auth('your_strong_password');
if ($redis->ping() === '+PONG') {
echo 'Redis connection successful!';
} else {
echo 'Redis connection failed!';
}
?>
If the output says Redis connection successful!, PHP on cPanel can communicate with Redis.
Enabling Redis Object Cache in WordPress
This is the question I get most often from clients. WordPress doesn’t use object caching by default, but with a plugin you can enable Redis Object Cache.
- Login to WordPress admin
- Install the “Redis Object Cache” plugin from the WordPress repository
- Once activated, go to Settings → Redis
- Click “Drop-in” to enable Redis as the object cache backend
- Verify the status shows Connected
You’ll also need to add this configuration to wp-config.php:
define('WP_REDIS_HOST', '127.0.0.1');
define('WP_REDIS_PORT', 6379);
define('WP_REDIS_PASSWORD', 'your_strong_password');
define('WP_REDIS_PREFIX', 'wp_');
define('WP_REDIS_MAXTTL', 86400); // 24 hours
After that, flush the cache in the Redis Object Cache plugin, and you’ll see the hit rate climbing within minutes.
Troubleshooting: Common Redis Issues on cPanel
From handling dozens of servers, here are the most common issues I encounter when installing Redis on cPanel:
| Problem | Symptom | Cause | Solution |
|---|---|---|---|
| Redis won’t start | Failed to start redis.service |
Port 6379 already in use / config syntax error | Check journalctl -xe, verify port with ss -tlnp | grep 6379 |
| PHP can’t connect | Class 'Redis' not found |
PHP extension not enabled / wrong PHP version | Enable extension in EasyApache 4 / MultiPHP Manager |
| Connection refused | Redis::connect() failed |
Redis bound to 127.0.0.1 but PHP using IPv6 / Redis not running | Verify Redis is running, test with redis-cli ping |
| Out of memory | OOM command not allowed |
maxmemory too low, data exceeds limit | Increase maxmemory or change maxmemory-policy to allkeys-lru |
| Authentication failed | NOAUTH Authentication required |
Password not set in PHP config / wrong password | Verify password in /etc/redis/redis.conf matches PHP config |
| Memory leak | RAM keeps growing, server slows down | Keys have no TTL, data accumulates indefinitely | Set TTL on keys, monitor with redis-cli info memory |
| Redis crash on startup | Redis is now ready to exit, bye bye... |
Corrupted RDB dump file | Remove dump.rdb and restart: rm /var/lib/redis/dump.rdb && systemctl restart redis |
Redis Monitoring Commands
After Redis is active, you need to monitor its performance regularly. Here are the commands I use most often for production Redis monitoring:
# General Redis info
redis-cli info server
# Memory usage details
redis-cli info memory
# Connected clients info
redis-cli info clients
# Statistics (hits, misses, etc.)
redis-cli info stats
# Real-time command monitoring
redis-cli monitor
# Count all stored keys
redis-cli keys '*' | wc -l
# Check current database size
redis-cli dbsize
The most important metric to watch is used_memory_human from the info memory output. Make sure it doesn’t exceed your configured maxmemory. If it’s getting close to the limit, you need to either increase maxmemory or optimize the keys being stored.
Best Practices for Production Redis on cPanel
From years of managing production servers, here are the practices I always follow:
1. Always Use a Strong Password
I’ve said this before, but it bears repeating. Generate a strong password, minimum 32 characters. Don’t reuse your cPanel or root password.
# Generate a random password
openssl rand -base64 32
2. Set maxmemory Based on Your Needs
Don’t let Redis consume all available server RAM. Rule of thumb: allocate a maximum of 25% of total server RAM to Redis. Example: on an 8GB RAM server, set Redis maxmemory to 2GB.
3. Monitor Regularly
Don’t install Redis and forget about it. Monitor at least once a week. Check that memory usage is reasonable, hit rates are good, and there are no errors in the logs.
4. Backup dump.rdb Automatically
Even with Redis persistence enabled, regularly back up the dump.rdb file. You can add a cron job:
# Backup Redis dump daily at 2 AM
0 2 * * * cp /var/lib/redis/dump.rdb /backup/redis/dump.rdb.$(date +%Y%m%d)
5. Restart Redis Periodically
Redis is very stable, but periodic restarts (e.g., once a week) can help clean up memory fragmentation. Set this up in cron:
# Restart Redis every Sunday at 3 AM
0 3 * * 0 systemctl restart redis
FAQ: Frequently Asked Questions
Q: Is Redis safe for shared hosting?
A: Technically, Redis can be installed on shared hosting if you have WHM access. In practice, Redis is better suited for VPS or dedicated servers where you have full control over resources. On shared hosting, resources are limited and shared among multiple users.
Q: How much RAM does Redis need?
A: It depends on the amount of data you want to cache. For a typical WordPress site, 256MB-512MB is sufficient. For large e-commerce sites or high-traffic applications, you might need 1GB or more. The key is not to allocate more than 25% of total server RAM.
Q: Does Redis replace WordPress caching plugins?
A: Not exactly. Redis provides object caching — it caches data at the database query level. You still need a caching plugin for page caching (full rendered HTML). The best strategy is combining both Redis and a page cache plugin for optimal performance.
Q: How do I verify Redis is working in WordPress?
A: Install the “Query Monitor” plugin in WordPress. Open any page, click the “Queries” tab → filter by “Object Cache”. If you see “Redis” listed with a hit rate above 90%, Redis is working properly.
Q: Will Redis lose data when the server restarts?
A: If you’ve enabled persistence (RDB or AOF), data won’t be lost on restart. Without persistence, only in-memory data is lost. For caching use cases, this is usually not a concern since the cache repopulates automatically.
Related Articles
- PHP-FPM Configuration on cPanel for Maximum Performance
- MySQL/MariaDB Optimization on VPS: A Complete NOC Engineer Guide
- WordPress Cache Plugin Comparison: WP Super Cache vs W3 Total Cache vs LiteSpeed
- Linux Server Monitoring: Tools and Commands Every NOC Engineer Should Know
- Fixing 502 Bad Gateway on VPS: Causes and Proven Solutions
Conclusion
Redis is no longer a “nice to have” — for any serious website on cPanel, it’s practically a must-have. With installation now incredibly straightforward through EasyApache 4 and native repositories, there’s really no excuse not to try it.
If your website still feels sluggish despite having powerful server specs, check whether you’re using Redis. Many performance issues can be resolved without hardware upgrades — just the right caching strategy in place.
Start installing Redis today and experience the difference. If you need help with setup or troubleshooting, don’t hesitate to reach out — we’re here to help.
Author: NOC Engineer — Syslog Solutions | Difficulty: Intermediate | Last Updated: July 2026 | Tested On: AlmaLinux 8/9, CloudLinux 8/9, Ubuntu 22.04/24.04, cPanel 118+