Appearance
Redis setup on Debian (Bookworm)
Moving Snipe-IT's cache and sessions to Redis fixes file-based session/cache bloat at the source and is required if you ever run Snipe-IT behind a load balancer across multiple app servers. This guide targets Debian 12 (Bookworm, kernel 6.1.x).
1. Install Redis server
bash
sudo apt update
sudo apt install redis-server
sudo systemctl enable --now redis-server
sudo systemctl status redis-serverDebian 12 ships Redis 7.0.x in the default repos.
2. Install the PHP Redis extension
Check which PHP version and SAPI Snipe-IT is running on first:
bash
php -v
dpkg -l | grep -i phpTwo common setups on Debian:
- PHP-FPM: install the versioned package, e.g.
sudo apt install php8.2-redis, thensudo systemctl restart php8.2-fpm - mod_php (Apache): install
sudo apt install php-redis— this pulls inphp8.2-redisandphp8.2-igbinaryand registers automatically with mod_php. There is no separate PHP-FPM service to restart; restart Apache instead:
bash
sudo systemctl restart apache2Verify the extension loaded:
bash
php -m | grep -i redis3. Update .env
In the Snipe-IT install directory (e.g. /var/www/snipe-it/.env):
CACHE_DRIVER=redis
SESSION_DRIVER=redis
QUEUE_CONNECTION=redis
REDIS_CLIENT=phpredis
REDIS_HOST=127.0.0.1
REDIS_PASSWORD=null
REDIS_PORT=63794. Secure Redis
Debian's default /etc/redis/redis.conf already binds to 127.0.0.1 -::1 with protected-mode yes, which is fine for a single-box setup:
bash
sudo grep -E '^(bind|protected-mode|requirepass)' /etc/redis/redis.confIf Snipe-IT and Redis are on separate hosts, set requirepass in redis.conf, restart Redis, and set REDIS_PASSWORD in .env to match.
5. Clear old file-based cache/sessions and restart
Use find, not a shell glob — see Session cleanup without Redis for why rm -rf sessions/* can fail outright on a directory that's already accumulated a large number of files:
bash
cd /var/www/snipe-it
sudo -u www-data php artisan config:clear
sudo -u www-data php artisan cache:clear
sudo find storage/framework/sessions/ -mindepth 1 -delete
sudo find storage/framework/cache/data/ -mindepth 1 -delete
sudo systemctl restart apache2 # or php8.2-fpm, whichever applies6. Verify
bash
redis-cli ping # should return PONG
redis-cli monitor # watch keys populate while browsing the app7. If using queues, run a worker
Moving QUEUE_CONNECTION to redis requires a queue worker process — Debian doesn't run this automatically. Set up a systemd service for:
bash
sudo -u www-data php artisan queue:work --daemon