- 22 Views
- 12/09/2025
How to enable redis.sock on redis server
You want to enable the Unix socket (redis.sock) for your Redis server. By default Redis only listens on TCP (127.0.0.1:6379), so you have to configure the socket manually.
Here’s the step-by-step guide (works on CentOS/RHEL with yum install redis, but very similar for Ubuntu/Debian too):
1. Edit the Redis config
Open the Redis config file (location may vary):
or sometimes:
Find and uncomment / add these lines:
unixsocket /var/run/redis/redis.sock
unixsocketperm 770
unixsocket→ path of the socket file. Commonly/var/run/redis/redis.sock.unixsocketperm→ permissions for the socket (770 means: owner + group can access).
2. Make sure the directory exists
sudo chown redis:redis /var/run/redis
3. Add your web/PHP user to the redis group
# or if using Apache with PHP-FPM
sudo usermod -aG redis apache
# or a DirectAdmin user
sudo usermod -aG redis user1
Replace with the actual user running PHP-FPM.
4. Restart Redis
5. Verify socket
Expected output (permissions may vary):
6. Test connection
Should return:
Now Redis is listening on both TCP (127.0.0.1:6379) and the Unix socket (/var/run/redis/redis.sock).
Thanks for visit my website
