Apply for Free VPS

Install Redis for caching and queues

Updated 27 Nov 2026 redis cache

Install Redis, keep it private and set a memory limit.

Install

sudo apt update && sudo apt install -y redis-server
redis-cli ping

Keep it private

In /etc/redis/redis.conf confirm:

bind 127.0.0.1 -::1
protected-mode yes
requirepass use-a-long-random-value

An exposed Redis server is quickly taken over. Never forward its port to the internet.

Limit memory

For a cache, evict old keys:

maxmemory 256mb
maxmemory-policy allkeys-lru

For queues or sessions that must not disappear, use noeviction and watch usage.

Persistence

Append-only mode loses less on a crash but writes more:

appendonly yes
appendfsync everysec

Apply and check

sudo systemctl restart redis-server
redis-cli -a 'your-password' info memory

Passing a password on the command line can leave it in history; set REDISCLI_AUTH instead.

Was this helpful?

Report outdated or incorrect information