The default Redis configuration file is located in the /etc/redis/redis.conf directory. The default configuration is when the Redis server listens for all available connections.
You can make it listen to the interfaces of your choice. This can be done by using the "bind" configuration directive that would be followed by a single or multiple IP addresses.
Step 1 - Edit the Redis Configuration File
To instruct the Redis server to listen for a particular IP address, you need to edit the /etc/redis/redis.conf file. Open it with your preferred editor. In our case, we are using the nano editor.
sudo nano /etc/redis/redis.conf
Locate the line “bind 127.0.0.1 ::1”.
Step 2 - Change the IP Address
Change the IP address by entering the values of the connections you want the Redis server to listen for. Here’s an example:
bind 70.25.220.238
In order to add multiple IP addresses, simply separate the IP addresses with a space like so:
bind 70.25.220.238 70.25.220.239
Here you need to enter the IP addresses of your network.
However, if you want the server to listen to all the interfaces on the network, you can comment out the bind line entirely:
# bind 127.0.0.1 ::1
Step 3 - Save and Restart Redis
Once you are done making changes, save and close the file. Then restart the Redis service to apply the changes:
sudo systemctl restart redis-server

