By
Thomas McKee
| Meta Title: Redis Object Cache Setup for LiteSpeed Cache in cPanel Meta Description: Learn how to configure Redis Object Cache with LiteSpeed Cache in cPanel for blazing-fast WordPress performance, improved SEO, and reliable caching. Boost your WordPress site’s speed and SEO with Redis Object Cache in LiteSpeed Cache. This guide walks you through setting up Redis at LiteSpeed Cache is a powerful plugin that leverages server-level caching to supercharge WordPress performance. When paired with Redis object caching, it reduces database load, speeds up dynamic content delivery, and boosts SEO by improving page load times and Google PageSpeed scores. Pro Tip: The cPanel hook ensures new accounts are automatically added to the For optimal performance, use the Redis Unix socket at Pro Tip: Combine with SEO optimization services and social media marketing for maximum site performance. Contact us for help setting up LiteSpeed on your site. Yes, Redis at No, cPanel’s security model uses separate users per account. Use the Check Redis status, socket permissions, and test connectivity with Redis Object Cache Setup Guide for LiteSpeed Cache in cPanel
TL;DR:
/var/run/redis/redis.sock, creating cPanel users, assigning them to the redis group, and configuring LiteSpeed Cache for optimal performance on AlmaLinux 8.10 with cPanel/WHM.Why Redis with LiteSpeed Cache Matters
Prerequisites
yum install redis; systemctl enable redis; systemctl start redis/etc/redis.conf configured with:
Restart Redis:
bind 127.0.0.1
port 6379
unixsocket /var/run/redis/redis.sock
unixsocketperm 770
systemctl restart redis
Adjust for your PHP version (e.g., yum install ea-php84-php-redis; systemctl restart lswsea-php82-php-redis).
wp plugin deactivate redis-object-cache --path=/home/newuser/public_htmlCreating a New cPanel User
Steps:
https://yourserver.com:2087).
yourdomain.comnewuser (e.g., tangobooking)redis group (via hook /usr/local/cpanel/hooks/postwwwacct/10-add-to-redis-group):
If groups newuserredis is missing, add manually as root:
usermod -aG redis newuserAssigning Users to Redis Group
Steps for Existing or Multiple Users:
usermod -aG redis newuserfor user in /home/*; do usermod -aG redis $(basename $user); donefor user in /home/*; do echo "$(basename $user): $(groups $(basename $user))"; donesystemctl restart lsws # Or httpdredis group, making this scalable for all sites.Configuring Redis Object Cache
/var/run/redis/redis.sock, which is faster than TCP connections.Settings:
https://yourdomain.com/cpanel).https://yourdomain.com/wp-admin):
/var/run/redis/redis.sock00 (or unique for multisite)
127.0.0.16379
https://yourdomain.com and check HTML source for Object Cache stats (e.g., <!-- Object Cache [total] 4643 [hit] 386 [miss] 81 -->).Troubleshooting
newuser:
Expected: redis-cli -s /var/run/redis/redis.sock pingPONG
Access
echo '<?php $redis = new Redis(); $redis->connect("/var/run/redis/redis.sock"); $result = $redis->ping(); var_dump($result); ?>' > /home/newuser/public_html/redis_test_sock.php
chown newuser:newuser /home/newuser/public_html/redis_test_sock.php
chmod 644 /home/newuser/public_html/redis_test_sock.php
https://yourdomain.com/redis_test_sock.php. Expected: string(5) "+PONG" or bool(true).
redis-cli -h 127.0.0.1 -p 6379 pingroot:
ls -l /var/run/redis/redis.sock
chown redis:redis /var/run/redis/redis.sock
chmod 770 /var/run/redis/redis.sock
systemctl restart redis
Add:
nano /home/newuser/public_html/fix_wp_permissions.sh
#!/bin/bash
cd /home/newuser/public_html
find . -type d -exec chmod 755 {} \;
find . -type f -exec chmod 644 {} \;
if [ -f wp-config.php ]; then
chmod 600 wp-config.php
fi
if [ -d wp-content ]; then
chmod -R 775 wp-content
fi
chown -R newuser:newuser .
echo "WordPress permissions restored."
chmod 700 /home/newuser/public_html/fix_wp_permissions.sh
/home/newuser/public_html/fix_wp_permissions.sh
echo "<Files fix_wp_permissions.sh>
Deny from all
</Files>" >> /home/newuser/public_html/.htaccess
wp option patch update litespeed-cache-conf object 1 --path=/home/newuser/public_html
cat /home/newuser/public_html/wp-content/debug.log
Add:
nano /home/newuser/public_html/wp-config.php
define('WP_DEBUG', true);
define('WP_DEBUG_LOG', true);
define('WP_DEBUG_DISPLAY', false);
cat /home/newuser/public_html/wp-content/debug.log
wp plugin deactivate w3-total-cache wp-rocket redis-object-cache --path=/home/newuser/public_htmlSecurity and Maintenance
/etc/redis.conf, set requirepass yourstrongpassword and update LiteSpeed Cache settings.systemctl status redissystemctl restart lswsKey Takeaways
/var/run/redis/redis.sock for fast object caching.redis group for scalable user access.FAQ
Does LiteSpeed Cache work with Redis?
/var/run/redis/redis.sock is the fastest way to enable object caching in LiteSpeed Cache.Can I use a single user for all cPanel accounts?
redis group to grant access to all cPanel users.What if the Connection Test fails?
redis-cli -s /var/run/redis/redis.sock ping. Ensure the cPanel user is in the redis group.



