Step 1: Install Redis on Your Server
Connect to your VPS via SSH as root.
Run the following command to install Redis:
bash
Copy
Edit
yum install redis -y
Start and enable Redis to run automatically on boot:
bash
Copy
Edit
systemctl start redis
systemctl enable redis
Step 2: Configure Redis for Performance
Open the Redis configuration file:
bash
Copy
Edit
Update the following settings:
Bind to localhost (for security)
ini
Copy
Edit
bind 127.0.0.1
Set a memory limit (adjust as needed)
ini
Copy
Edit
maxmemory 512mb
maxmemory-policy allkeys-lru
Save and exit (CTRL + X → Y → ENTER).
Restart Redis to apply changes:
bash
Copy
Edit
systemctl restart redis
Step 3: Install the PHP Redis Extension
Install the Redis PHP extension for each PHP version you are using:
bash
Copy
Edit
yum install ea-phpXX-php-redis -y
(Replace XX with your PHP version, e.g., ea-php81-php-redis for PHP 8.1).
Restart LiteSpeed to apply changes:
bash
Copy
Edit
systemctl restart lsws
Step 4: Enable Redis in LiteSpeed Cache
If you are using WordPress LiteSpeed Cache Plugin:
Go to LiteSpeed Cache > Cache > Object.
Set Object Cache to ON.
Choose Redis as the method.
Set Host to 127.0.0.1 and Port to 6379.
Save changes and click Test Connection.
If you are using Magento, OpenCart, or other CMS, Redis integration can be enabled via their caching settings.
Step 5: Verify Redis is Working
Run the following command in SSH:
bash
Copy
Edit
redis-cli ping
If it returns PONG, Redis is running correctly!
*Final Notes*
Redis is now set up and working with LiteSpeed Cache on your shared hosting.
You can monitor Redis usage with:
bash
Copy
Edit
redis-cli info
If Redis does not work, check logs:
bash
Copy
Edit
tail -f /var/log/redis/redis.log