1 Install Redis Server
apt install redis-server -y
systemctl enable redis-server
systemctl start redis-server
# Test — should return PONG
redis-cli ping
2 Install PHP Redis Extension
apt install php8.3-redis -y
systemctl restart php8.3-fpm
# Verify extension is loaded
php -m | grep redis
You should see redis in the output.
3 Install WP-CLI
WP-CLI lets you manage WordPress from the terminal — essential for managing plugins and cache:
curl -O https://raw.githubusercontent.com/wp-cli/builds/gh-pages/phar/wp-cli.phar
chmod +x wp-cli.phar
mv wp-cli.phar /usr/local/bin/wp
# Verify
wp --info --allow-root
4 Install Redis Object Cache Plugin
cd /var/www/html/wordpress wp plugin install redis-cache --activate --allow-root
The plugin is Redis Object Cache by Till Krüss — the most widely used Redis integration for WordPress with 100k+ active installs.
5 Configure wp-config.php
Add these constants above the /* That's all, stop editing! */ line:
define('WP_REDIS_HOST', '127.0.0.1');
define('WP_REDIS_PORT', 6379);
define('WP_REDIS_TIMEOUT', 1);
define('WP_REDIS_READ_TIMEOUT', 1);
define('WP_REDIS_DATABASE', 0);
6 Enable Object Cache
cd /var/www/html/wordpress wp redis enable --allow-root
Expected output: Success: Object cache enabled.
The PHP warnings about DB_HOST already defined and HTTP_X_FORWARDED_PROTO
are
harmless — they come from WP-CLI running outside of HTTP context.
7 Verify It's Working
# Full status check wp redis status --allow-root # Watch live Redis commands (browse your site while this runs) redis-cli monitor # Check hit/miss ratio after some traffic redis-cli info stats | grep keyspace_hits redis-cli info stats | grep keyspace_misses
If wp redis status shows Status: Connected and Drop-in:
Valid — Redis is fully wired up and caching WordPress database queries.
That wraps up the 5-post VPS series. You now have a hardened, fast, self-hosted WordPress stack for under $8/month.