Redis installation from within Virtualmin

Several years back, WordPress incorporated “Site Health” into the dashboard. One of the constant nags it presents to administrators is this warning:
You should use a persistent object cache

While it is only a Site Health recommended improvement, the notification persists. And there is little doubt using Redis greatly improves site speed. We use it on all of our DirectAdmin boxes.

With 43% (and growing) of all websites using WordPress, it makes sense to make Redis part of (or controllable through) Virtualmin in the same sense as are many of Virtualmin’s other great features.

It could be a check box, in the same manner as, for example, the database functionality is chosen. Once installing a plugin to use Redis in WordPress, one has to simply place an appropriate line (using the site’s file editor) in order for it to function. Ours are all placed near the top of the wp-config.php file and have this format:

define( 'WP_REDIS_SCHEME', 'unix' );
define( 'WP_REDIS_PATH', '/home/username/.redis/redis.sock' );

Ultimately, I believe Virtualmin’s value would be increased if an easy installation of Redis was incorporated into it. Many of the other control panels (DirectAdmin and cPanel that I’m aware of) incorporate easy integration through them.

As a website developer, it would be wonderful to be able to move websites in either direction between Virtualmin and DirectAdmin boxes that use Redis and have them simply work.

1 Like

We’d want to use Valkey or one of the other Open Source forks of redis if we do something along these lins, as redis will be leaving the OSS distributions pretty soon (as redis is no longer Open Source, merely source-available).

2 Likes

Thats’ fine, anything would be better than nothing, I guess… Can you add this to a feature request list please?

This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.

UPDATE:

After more research on and off, I discovered it is actually very straightforward to add Redis to a Debian 12 box running Virtualmin. Here is what I did (locally at the command prompt logged in as root) that I tested on several Debian boxes in a number of WordPress installations:

  1. Install the Redis PHP module in your PHP versions. I used (I included intl because WordPress installations squawked about it in the Site Health when it’s missing):
    for php in $(ls /etc/php); do sudo apt-get install -y “php$php-”{intl,redis}; done
  2. Install the Redis server:
    apt-get update
    apt-get install redis-server
    systemctl status redis-server
  3. In WordPress, you can install the Redis Object Cache plugin by Till Krüss. Once installed, navigating to its settings you should see an Enable Object Cache button. Click that.

That’s it. Couldn’t be more straightforward.

Note: I found that when moving a site from a DirectAdmin system that uses Redis, the site appeared broken when I tried to view it. I got a Redis connection error (similar to the beloved Database Connection Error we have all seen at one time or another). Provided you have Redis PHP modules and Redis Server installed on the Virtualmin box, all you should have to do is go into the file editor for the site and remove (or comment out) the two lines in wp-config.php (like in the first post I made above here) and save it. Then you might have to flush the cache and then enable the object cache again.

4 Likes

I’ll need to test on rocky, wordpress complains about no object caching.

In my case, I prefer to use Memcached. Less difficult to install and to maintain. If you use PHP-FPM, Opcache and Memcached, the results with WordPress are very good. :slight_smile:

Memcached is old and not as good as Redis. Easier to setup though. You should consider moving to redis or a fork of it.

I only need something simple, :slight_smile: not the extra features of Redis. Possible, Memcached is old, but sites like wordpress.org and a lot of managed cloud hosting are using it

That is Redis. If you don’t have WP you only need to install it and use it. no other clutter needed.

So, one of the possibilities is to go with the fork of Redis, Valkey. I see the package in EPEL: https://pkgs.org/search/?q=valkey

I’m going to give it a chance :slight_smile: