August 19, 2026 · by CLIQHOST
If your web application is hammering the database with repeated queries, Redis can be the single change that dramatically cuts response times. Redis (Remote Dictionary Server) is an open-source, in-memory key-value store widely used for caching, session management, and message queuing.
In this guide, you will learn how to install, configure, and secure Redis on a NVMe VPS or SSD VPS running Ubuntu 22.04 or Debian 12 — from scratch to a production-ready setup.
Redis operates entirely in RAM, delivering sub-millisecond latency for most operations. Common use cases include:
Platforms such as WordPress, Laravel, Magento, and Django all have native or plugin-based Redis support.
sudo privilegesAlways start with a system update to avoid dependency conflicts:
sudo apt update && sudo apt upgrade -y
This ensures you receive the latest stable Redis version from the official repositories.
Redis is available in the default Ubuntu 22.04 and Debian 12 repositories:
sudo apt install redis-server -y
Confirm the installed version:
redis-server --version
# Redis server v=7.x.x ...
Enable and start the service:
sudo systemctl enable redis-server
sudo systemctl start redis-server
Check the status:
sudo systemctl status redis-server
You should see active (running) highlighted in green.
Use the built-in CLI client:
redis-cli ping
# PONG
Set and retrieve a test value:
redis-cli SET test_key "CliqHost Redis"
redis-cli GET test_key
# "CliqHost Redis"
If you see the expected responses, Redis is running correctly.
The main configuration file lives at /etc/redis/redis.conf. Open it with your editor:
sudo nano /etc/redis/redis.conf
Because we are using systemd, change:
supervised no
to:
supervised systemd
For a server with 2 GB RAM shared between the application and Redis, allocate 512 MB:
maxmemory 512mb
maxmemory-policy allkeys-lru
The allkeys-lru eviction policy removes the least-recently-used keys when memory is full — perfect for a cache layer.
If Redis is used only for caching, disable persistence for maximum throughput:
save ""
appendonly no
If you need data to survive restarts (sessions, queues), enable AOF persistence:
appendonly yes
appendfsync everysec
Save the file and restart Redis:
sudo systemctl restart redis-server
By default, Redis listens only on 127.0.0.1, which is the correct setting for single-server deployments. Verify this in redis.conf:
bind 127.0.0.1 ::1
Locate the commented # requirepass line and add:
requirepass YourLongAndComplexPasswordHere
Generate a strong password with:
openssl rand -base64 32
Rename or disable commands that could wipe your data:
rename-command FLUSHALL ""
rename-command FLUSHDB ""
rename-command CONFIG "CONFIG_SECRET_STRING"
Ensure port 6379 is not exposed to the internet. On a server protected by UFW firewall:
sudo ufw deny 6379
To allow a specific trusted IP only:
sudo ufw allow from 203.0.113.10 to any port 6379
Restart Redis to apply all configuration changes:
sudo systemctl restart redis-server
After setting a password, connect using:
redis-cli -a 'YourLongAndComplexPasswordHere' ping
# PONG
Or authenticate interactively:
redis-cli
127.0.0.1:6379> AUTH YourLongAndComplexPasswordHere
OK
127.0.0.1:6379> ping
PONG
If you run WordPress on a managed WordPress hosting plan or a VPS, you can enable Redis object caching to drastically reduce database load.
WordPress Admin → Plugins → Add New → search for Redis Object Cache → Install → Activate.
Then add the following constants to wp-config.php:
define('WP_REDIS_HOST', '127.0.0.1');
define('WP_REDIS_PORT', 6379);
define('WP_REDIS_PASSWORD', 'YourLongAndComplexPasswordHere');
define('WP_REDIS_TIMEOUT', 1);
define('WP_REDIS_READ_TIMEOUT', 1);
define('WP_REDIS_DATABASE', 0);
From the plugin dashboard, click Enable Object Cache. You will immediately notice a significant drop in SQL queries per page load.
Watch live commands in real time:
redis-cli monitor
Check server statistics:
redis-cli info stats
redis-cli info memory
Key metrics to watch:
| Metric | What It Means |
|---|---|
used_memory_human |
RAM currently used by Redis |
keyspace_hits |
Requests served from cache |
keyspace_misses |
Cache misses (data not found) |
connected_clients |
Active client connections |
A hits/misses ratio above 90% indicates an efficient cache configuration.
Redis ships with 16 logical databases (0–15). Keep different data types isolated:
SELECT 0 # application cache
SELECT 1 # user sessions
SELECT 2 # rate limiting counters
Redis recommends disabling THP to avoid latency spikes:
echo never | sudo tee /sys/kernel/mm/transparent_hugepage/enabled
Add the same line to /etc/rc.local so the setting persists across reboots.
echo 'vm.overcommit_memory = 1' | sudo tee -a /etc/sysctl.conf
sudo sysctl -p
This prevents the warning MISCONF Redis is configured to save RDB snapshots during fork operations.
For professional, hands-off server management, check out the server management services offered by CLIQHOST.
Redis is one of the most impactful additions you can make to a Linux server stack. With proper memory limits, an LRU eviction policy, a strong password, and a locked-down firewall, you have a fast and secure caching layer ready for production.
Looking for a high-performance environment to run Redis on? Explore the NVMe VPS plans at CLIQHOST for low-latency storage, or go with a managed dedicated server for large-scale deployments. Questions? Get in touch with our team — we are happy to help you get set up.
Real reviews from customers who trust CLIQHOST for performance, reliability and expert technical support.
"We moved our online shop from a foreign host and the difference is night and day — pages load instantly and support replies in minutes, in Romanian."
"Migrated 12 client sites to CLIQHOST. Free migration, zero downtime, and the cPanel setup is exactly what my team needed. Highly recommend."
"Our NVMe VPS handles traffic spikes without a sweat. Full root, local datacenter, and billing in MDL — everything we wanted from a provider."