How to connect to Redis by Unix socket only

To disable the ability to connect to Redis-server via TCP, it is necessary in the configuration file redis.conf to set the value:

port 0

Also, you need to set to allow connection via unix socket:

unixsocket /tmp/redis.sock
unixsocketperm 755

And restart your Redis server.