WEB WORKBENCH

My Project Workspace

A collection of systems, experiments, and builds

What is Redis Server

Redis is an in-memory object cache. Instead of WordPress repeatedly asking the database for the same information, Redis can keep frequently used data in RAM and return it much faster.

You may also see Memcached mentioned as an alternative. Both provide object caching, but Redis offers more features and flexibility and is particularly useful where a site has more demanding caching requirements.

WordPress lists a persistent object cache as an optional extra in Site Health. It isn't required for WordPress to work, but it can reduce database work and improve performance. Because Redis stores its active data in memory, available RAM is an important consideration.

This can be particularly useful on WooCommerce sites, where there is often more database activity and memory usage than on a simple brochure-style WordPress site.

You don't necessarily need an expensive managed Redis service. If you already have a VPS, server or suitable home server, running your own Redis instance can be a relatively inexpensive way of adding Redis to WordPress — and it is also a useful learning exercise.

This is a practical reference based on getting a remote Redis server working with a WordPress plugin, including some of the less obvious problems that can occur.

Check Redis before changing anything

Don't blindly change the Redis network configuration. First see what Redis is currently using:

CONFIG GET bind

And check protected mode:

CONFIG GET protected-mode

These two commands are useful when troubleshooting why a remote connection isn't working.

Local or remote Redis?

If WordPress and Redis are on the same server, the connection will normally be:

127.0.0.1:6379

With a separate Redis server, WordPress connects to its IP address:

192.168.1.20:6379

or, where necessary, a public IP.

Local Redis is simpler and avoids network issues. Remote Redis can be useful when you deliberately want Redis separated from the web server, but it introduces firewall and network considerations.

Installing Redis on Ubuntu

On a fresh Ubuntu server, install Redis with:

sudo apt update
sudo apt install redis-server

Check that the service is running:

sudo systemctl status redis

Then test Redis locally:

redis-cli ping

You should get:

PONG

If you don't get PONG, there is no point troubleshooting the remote connection yet.

Check the Redis configuration

Before changing anything, see what Redis is currently configured to use.

Start the Redis CLI:

redis-cli

If authentication is already enabled:

redis-cli --user USERNAME -a PASSWORD

Then check the network configuration:

CONFIG GET bind

And protected mode:

CONFIG GET protected-mode

These commands let you see the current settings without blindly changing them. Be particularly careful with bind and protected mode when exposing Redis remotely.

Create an ACL user

Redis supports ACL users, allowing an application to have its own username, password and permissions.

For our WordPress plugin we used:

ACL SETUSER test on resetpass >testing123 ~* +@read +@write +@connection +info +scan +select +dbsize

The permissions include the commands our plugin needs to read and write cache data, connect, select a database and perform information and scanning operations.

Check the user:

ACL GETUSER test

List all users:

ACL LIST

Disable a user:

ACL SETUSER test off

Delete a user:

ACL DELUSER test

Reset its password:

ACL SETUSER test resetpass >NewPasswordHere

Use a strong password in a real installation.

Redis databases

Redis supports multiple logical databases. If your WordPress plugin has a Database setting, make sure it matches the database you want to use.

For example:

SELECT 5

You can test it with:

SET test:key "hello"
GET test:key

Useful commands

There are two places you'll be entering commands: the normal SSH/Ubuntu terminal, and the Redis CLI.

From SSH / the Ubuntu terminal

Check that the Redis service is running:

sudo systemctl status redis

See what address and port Redis is listening on:

sudo ss -lntp | grep 6379

Connect to Redis:

redis-cli

Once you see the Redis prompt, you are now inside the Redis CLI.

Inside the Redis CLI

Check that Redis is responding:

PING

Returns:

PONG

Check the current network binding:

CONFIG GET bind

Check protected mode:

CONFIG GET protected-mode

See general Redis information:

INFO

See how many keys are in the current database:

DBSIZE

Look through keys in the current database:

SCAN 0

See clients currently connected to Redis:

CLIENT LIST

These commands are particularly useful when troubleshooting a remote connection because they let you establish whether Redis is running, what it is listening on, whether it is responding and whether the remote WordPress server is actually connecting.

Test the remote connection

Before troubleshooting WordPress, test Redis directly from the WordPress server:

redis-cli -h REDIS_SERVER_IP -p 6379 --user test -a PASSWORD PING

A successful connection returns:

PONG

If it times out, investigate the firewall and network before changing the WordPress plugin.

When port 6379 isn't allowed

This was the awkward part of our setup. The host/network would not allow normal Redis traffic on port 6379.

For a home-server setup, we therefore used a workaround where an allowed port — 465 — was redirected through to Redis on 6379. WordPress connected using the permitted external port while Redis continued running internally on its normal port.

This is not a standard Redis configuration and should be treated as a workaround for a specific network restriction. The forwarded port still needs appropriate firewall protection.

Using Redis with WordPress

If you're setting up Redis specifically for WordPress, I built Tudors Redis to make the connection and management easier, particularly when multiple WordPress sites share the same Redis server.

It supports both local and external Redis servers, Redis 6+ ACL authentication, per-site database assignment and automatic namespace isolation.

Tudors Redis — Redis Object Cache Plugin for Managed WordPress Hosting

The plugin is free and is designed for WordPress running on VPS, Virtualmin, cPanel, dedicated and managed hosting environments.

Firewall note

For a remote Redis server, the safest approach is to allow Redis access only from the IP address of the server that needs it, rather than opening port 6379 to everyone.

With UFW, for example:

sudo ufw allow from YOUR.WORDPRESS.IP to any port 6379

With firewalld:

sudo firewall-cmd --permanent --add-rich-rule='rule family="ipv4" source address="YOUR.WORDPRESS.IP" port port="6379" protocol="tcp" accept'
sudo firewall-cmd --reload

If you're using the 465 → 6379 workaround, apply the same principle to the external port being forwarded.

Avoid simply opening Redis with:

sudo ufw allow 6379

unless you have a specific reason to expose it more widely.

Summary

Running your own Redis server can avoid the cost of another managed service while giving you considerably more control. The tricky part isn't Redis itself — it's getting all the pieces to agree: networking, authentication, ACL permissions, database selection, firewall rules and, occasionally, awkward hosting restrictions.

Once those pieces are understood, Redis is surprisingly straightforward. And after battling with a remote connection, seeing PONG come back is rather satisfying.

Found This Useful?

If you found this useful, please consider sharing it.

InfoAbout Cookie infoContactFAQsTermsDisclosure