Guide

Properly Set Up Redis Cache on WordPress Powered with CloudPanel

Pinterest LinkedIn Tumblr

It is amazing that Redis Object Cache comes by default in every CloudPanel installation.

That said, you don’t have to do anything in the server side. All you have to do is making sure that your website can take advantage of Redis.

Redis is an open source, in-memory data structure store, used as a database, caching mechanism.

Many content frameworks such as WordPress rely heavily on database to store all information.

Calling database every time visitors make requests is not an effective mechaanism.

There comes Redis.

How to Install Redis on CloudPanel?

There is nothing to do. Simply install CloudPanel and you’ll have Nginx, PHP-fpm, MySQL, and Redis Cache in one complete stack.

Installing CloudPanel means installing a complete LEMP stack plus Redis.

Being installed and active by default, doesn’t mean you can make use of it directly.

At least for WordPress, there are things to do.

Setting Up WordPress for Redis Cache

Prerequisites

  1. Deploy a Debian 10 server
  2. Install CloudPanel
  3. Install WordPress
  4. (Optionally) Install SSL

Steps to Set Up Redis Cache

First, login to your server using WinSCP (or any of your favourite FTP client).

Second, edit wp-config.php file.

Third, add following line:

define('FS_METHOD', 'direct');

Save and close the file.

This is necessary so you can download, install, and update any Plugins and/or Themes directly from your Dashboard.

Next, go to Plugins > Add New > search for “Redis“.

Install and activate Redis Object Cache plugin.

Now go to Settings > Redis. This brings you to the Redis configuration page.

Click the Enable Object Cache button.

Once enabled, you’ll see something like this:

The above details indicate that WordPress can communicate with Redis server successfully.

That’s it. Every page request made by visitors now served from Redis Cache.

Such a caching mechanism avoid your MySQL database from being accessed too frequently. Hence, you can increase server performance without having to upgrade its specs.

How to Know if Redis is Working?

Simple. Launch a new browser window, open your site, and see its source code.

In common web browsers like Google Chrome, you can do this by hitting Control+U buttons on keyboard.

You’ll see a nice status line displayed at the bottom.

Enjoy!

F.A.Q

Can I combine Redis and WP Super Cache? Absolutely!

Can I use Cache Enabler with Redis Cache together? Of course!

Can I use W3 Total Cache and Redis? Yes, but you have to uninstall Redis Object Cache plugin and set Redis parameter manually in W3TC.

A blogger by hobby. He is an ordinary worker at day, a hybrid sys-admin at night. Sharing knowledge through blogs is his passion. He likes ice cream BTW.

Write A Comment