![]() |
|
Guide Redis Object Cache for WordPress on CyberPanel With LiteSpeed Cache - Printable Version +- AdminsForum (https://adminsforum.com) +-- Forum: Free & open-source control panels (https://adminsforum.com/Forum-free-open-source-control-panels) +--- Forum: CyberPanel (https://adminsforum.com/Forum-cyberpanel) +---- Forum: CyberPanel Guides & Tutorials (https://adminsforum.com/Forum-cyberpanel-guides-tutorials) +----- Forum: CyberPanel Websites & OpenLiteSpeed Guides (https://adminsforum.com/Forum-cyberpanel-websites-openlitespeed-guides) +----- Thread: Guide Redis Object Cache for WordPress on CyberPanel With LiteSpeed Cache (/Thread-guide-redis-object-cache-for-wordpress-on-cyberpanel-with-litespeed-cache) |
Redis Object Cache for WordPress on CyberPanel With LiteSpeed Cache - JAY - 10-26-2026 Redis Object Cache for WordPress on CyberPanel With LiteSpeed Cache Page cache (LiteSpeed Cache) serves finished pages to visitors. It doesn't help logged-in users, WooCommerce carts, or the admin area, where every page still runs dozens of database queries. An object cache keeps the results of those queries in memory, so WordPress asks MySQL less often. On CyberPanel the pieces are already on the server; you only have to connect them. We did it on our test site and checked every step. Step 1: Check Redis is installed and running CyberPanel 3.0 installed Redis for us during setup. Check yours: Code: systemctl is-active redis-server
redis-cli ping
redis-server --versionCode: activeCode: PONGCode: apt install -y redis-serverCode: systemctl enable --now redis-serverMake sure it only listens on the server itself: Code: ss -ltnp | grep 6379Code: 127.0.0.1:6379Code: [::1]:6379Code: bind 127.0.0.1 -::1Code: /etc/redis/redis.confStep 2: Check the PHP extension WordPress talks to Redis through the PHP redis extension, and it has to be loaded in the PHP version your site uses: Code: ls /usr/local/lsws/lsphp*/etc/php/*/mods-available/ | grep redisCode: 50-redis.iniStep 3: Turn on Object Cache in LiteSpeed Cache In WordPress admin open LiteSpeed Cache > Cache > Object. Set Object Cache to ON, Method to Redis, Host Code: 127.0.0.1Code: 6379Watch the defaults. Before we changed anything, LiteSpeed Cache was set to Memcached on port Code: 11211Code: wp litespeed-option get object-kind -> 0 (0 = Memcached, 1 = Redis)
wp litespeed-option get object-port -> 11211Code: lsmcdWe switched it on from SSH with WP-CLI. Each command answers with the saved value, and LiteSpeed Cache writes the drop-in file right away: Code: cd /home/yourdomain.com/public_html
sudo -u SITEUSER wp litespeed-option set object-kind 1
sudo -u SITEUSER wp litespeed-option set object-host 127.0.0.1
sudo -u SITEUSER wp litespeed-option set object-port 6379
sudo -u SITEUSER wp litespeed-option set object trueCode: SITEUSERCode: cyber2602Code: stat -c %U .Code: wp-content/object-cache.phpStep 4: Prove it works Before: Code: redis-cli dbsizeLoad a few pages and look at the Redis hit counter, then cap the memory: Code: # redis-cli info stats | grep keyspace
keyspace_hits:105
keyspace_misses:45
# redis-cli config set maxmemory 256mb
OK
# redis-cli config set maxmemory-policy allkeys-lru
OK
# redis-cli config rewrite
OK
# grep -E '^maxmemory' /etc/redis/redis.conf
maxmemory 256mb
maxmemory-policy allkeys-lruCode: for i in 1 2 3; do curl -sk -o /dev/null https://yourdomain.com/?nc=$i; done
redis-cli info stats | grep keyspaceCode: keyspace_hits:105Code: keyspace_misses:45Step 5: Give Redis a memory limit Out of the box ours had Code: maxmemory_human:0BCode: redis-cli config set maxmemory 256mb
redis-cli config set maxmemory-policy allkeys-lru
redis-cli config rewriteCode: config rewriteCode: /etc/redis/redis.confSeveral sites on one server LiteSpeed Cache puts a long per-site prefix in front of every key, so two sites don't read each other's entries. But clearing the cache is wider than one site. We put a test key in Redis database 5, then ran: Code: sudo -u cyber2602 wp cache flush
redis-cli dbsize; redis-cli -n 5 dbsizeCode: sudo -u SITEUSER wp litespeed-option set object-db_id 2Code: redis-cli -n 2 dbsizeFor the same reason, don't run Code: redis-cli flushallAlso know that Redis on CyberPanel has no password by default ( Code: grep -c ^requirepass /etc/redis/redis.confCode: requirepassCode: redis.confCommon problems
More CyberPanel guides
Tested on CyberPanel 3.0 (build 8, OpenLiteSpeed edition) on Ubuntu 24.04, October 2026. Menu names can change slightly between versions. |