HostCart
All articles
Web Panel

Complete Configuration Guide: How to Set Up LSCache and Redis Object Caching in cPanel

Discover how pairing LiteSpeed Cache with Redis object caching on a cPanel‑managed server can slash page‑load times, boost SEO, and reduce server strain. This guide walks you through installing LiteSpeed, configuring LSCache, setting up Redis, and fine‑tuning both layers for peak performance and scalability.

6 min read
Complete Configuration Guide: How to Set Up LSCache and Redis Object Caching in cPanel

Delivering fast, reliable WordPress sites on a cPanel‑managed server is easiest when you combine two powerful technologies: LiteSpeed Cache (LSCache) and Redis object caching. LSCache serves static HTML pages, slashing PHP execution time, while Redis keeps database query results and PHP objects in memory, eliminating repetitive queries. Together they cut page‑load times, boost SEO rankings, and reduce server load.

Why Pair LSCache with Redis?

  • Complementary layers: LSCache stores the final HTML output; Redis caches the data needed to generate that HTML.
  • Lower server overhead: Fewer PHP processes and database calls mean reduced CPU and RAM usage, allowing more sites per server.
  • Better user experience: Faster pages lower bounce rates and raise conversion rates.
  • Scalability: During traffic spikes the caches absorb the load, keeping the site responsive.

Prerequisites

  1. cPanel access: Root or reseller privileges that let you install software via WHM or the command line.
  2. LiteSpeed Web Server: LSCache works only with LiteSpeed/OpenLiteSpeed. If you’re on Apache, switch to LiteSpeed or enable the LiteSpeed plugin for Apache (performance will be limited).
  3. Redis installed: Most modern cPanel servers include Redis in WHM’s “Software” section. If not, you’ll need root access to install it manually.
  4. WordPress site: A functional WordPress installation with admin rights.

Step‑by‑Step Configuration

1. Install and Enable LiteSpeed Web Server

If LiteSpeed isn’t already running, do the following in WHM:

  1. Log in to WHM as root.
  2. Navigate to Software → LiteSpeed Web Server → Install LiteSpeed. Choose OpenLiteSpeed for a cost‑effective setup or LiteSpeed Enterprise for premium performance.
  3. After installation, go to LiteSpeed Web Server → Manage LiteSpeed and click Start LiteSpeed.
  4. Set LiteSpeed as the default web server under Service Configuration → Apache Configuration → Switch to LiteSpeed. Confirm and restart the service.

When active, a “LiteSpeed Web Server” banner appears in the cPanel dashboard.

2. Install the LSCache Plugin for WordPress

From the WordPress admin panel:

  1. Go to Plugins → Add New.
  2. Search for “LiteSpeed Cache”.
  3. Click Install Now, then Activate.

The plugin automatically detects LiteSpeed and enables basic page caching. You’ll want to fine‑tune the settings for optimal results.

3. Configure LSCache Settings

Visit LiteSpeed Cache → Settings and adjust the most important sections:

  • Cache → General
    • Cache Logged‑In Users: Enable only on low‑traffic sites; otherwise keep disabled to avoid serving stale personalized content.
    • Cache Mobile: Turn on if you serve a mobile‑first audience. LiteSpeed can keep separate caches for desktop and mobile.
  • Cache → TTL (Time‑to‑Live): Typical values are 3600 seconds for pages and 86400 seconds for static assets. Use shorter TTLs for news sites that update frequently.
  • Purge → Automatic: Enable “Purge All On Upgrade” and “Purge All On Post Update” to keep the cache fresh.
  • Optimization → CSS/JS: Enable minify, combine, and defer options, but test each change to avoid breaking scripts.

Save the settings, then click “Purge All” to clear any old cache and generate fresh files.

4. Install Redis Server via WHM

In WHM:

  1. Go to Software → Install Redis. If the option is missing, install via SSH:
# CentOS / RHEL
yum install redis
systemctl enable redis
systemctl start redis

# Ubuntu / Debian
apt-get update
apt-get install redis-server
systemctl enable redis-server
systemctl start redis-server

Confirm Redis is listening on 127.0.0.1:6379 (the default) with:

redis-cli ping   # returns PONG

5. Install a Redis Object‑Cache Plugin for WordPress

Two popular choices are “Redis Object Cache” (by Till Krüss) and “WP Redis”. The installation steps are identical:

  1. In WordPress, go to Plugins → Add New.
  2. Search for “Redis Object Cache”.
  3. Install and activate the plugin.

6. Configure the Redis Plugin

After activation a new Redis menu appears under Settings. Click it and set:

  • Host: 127.0.0.1
  • Port: 6379
  • Password: Leave blank unless you configured authentication in /etc/redis/redis.conf.
  • Press Enable Object Cache. A success message confirms the connection.

If you see “Connection failed”, verify that Redis is running and that no firewall blocks port 6379.

7. Verify Both Caches Are Working

  • LSCache: Install the LiteSpeed Cache Debugger Chrome extension. A green icon on a page indicates a cache hit.
  • Redis: The Redis plugin adds an admin‑bar indicator showing hits/misses. On the server you can run redis-cli info stats to view keyspace_hits and keyspace_misses.

Troubleshooting Common Issues

Cache Not Being Served

  • Make sure the .htaccess file contains LiteSpeed directives. The LSCache plugin normally writes them, but a custom .htaccess can override them.
  • If you use a CDN, ensure it doesn’t strip the Cache‑Control header. For Cloudflare, set “Cache Level” to “Standard” and enable “Cache Everything” for static pages.

Redis Connection Errors

  • Check that Redis is bound to the correct interface. In /etc/redis/redis.conf you should see bind 127.0.0.1.
  • If you enabled a password, add it to the plugin settings and restart Redis.
  • Review SELinux/AppArmor logs if the web‑user is denied access.

Performance Degradation After Enabling Caches

  • Aggressive minification can break JavaScript. Use LSCache’s “Test Mode” in the Optimization tab to preview changes before applying them globally.
  • Monitor server memory. Redis stores data in RAM; if memory is limited, set maxmemory in redis.conf and choose an eviction policy such as volatile-lru.

Best Practices for Ongoing Maintenance

  • Regularly purge stale caches: Schedule a cron job (e.g., wp lscache-purge all) during low‑traffic periods for sites that update frequently.
  • Monitor Redis metrics: Set alerts for memory usage and aim for a hit rate above 90 %.
  • Keep plugins up to date: LSCache and Redis plugins receive performance improvements and security patches.
  • Test after major changes: Whenever you add a new theme or plugin, verify that caching still works and that page output remains correct.

Conclusion

Configuring LSCache and Redis object caching on a cPanel server can turn a sluggish WordPress installation into a lightning‑fast, scalable platform. By installing LiteSpeed, enabling the LSCache plugin, setting up Redis, and fine‑tuning both caches, you’ll lower server load, improve user experience, and gain a measurable SEO advantage. Keep an eye on performance metrics, update your software regularly, and adjust TTLs as your content strategy evolves. With LSCache and Redis working together, your site will be ready for traffic spikes and deliver content at breakneck speed.

wordpresslitespeedrediscachecpaneloptimizationperformance

More in Web Panel

Domain Name Theft & Hijacking: 5 Essential Steps to Protect Your Registrar Account

Domain Name Theft & Hijacking: 5 Essential Steps to Protect Your Registrar Account

In today's hyper‑connected world, a domain name is a vital asset that cybercriminals constantly target, making robust protection essential. By choosing a reputable registrar, hardening credentials, enabling domain‑level safeguards, monitoring activity, and training staff, you can keep your digital real‑estate secure and maintain full control over your online presence.

“Seamless Integration: How to Embed JetBackup 5 Client Portals Directly into Your WHMCS Client Area”

“Seamless Integration: How to Embed JetBackup 5 Client Portals Directly into Your WHMCS Client Area”

Embedding JetBackup 5’s self‑service portal directly into the WHMCS client area gives hosting providers a friction‑free, branded backup experience that cuts support tickets and opens upsell opportunities. This guide walks you through installing the official JetBackup addon, crafting a custom WHMCS template with an iframe, and using a secure WHMCS hook to generate time‑limited portal URLs—all while keeping security tight and the integration future‑proof.

Mastering CloudLinux Node Rebalancing: A Step‑by‑Step Guide for Multi‑WHM Bare Metal Environments

Mastering CloudLinux Node Rebalancing: A Step‑by‑Step Guide for Multi‑WHM Bare Metal Environments

Managing a fleet of WHM/cPanel servers with CloudLinux can feel like juggling flaming torches, but automated node rebalancing turns that chaos into a well‑orchestrated performance symphony. By evenly redistributing LVE cages across bare‑metal nodes, you maximize hardware ROI, maintain consistent CPU and memory allocation, and free your team from tedious manual migrations.