Matomo Analytics

In order for you to connect to a separate, remote redis server we have to change some configuration values.

By default, your redis server is listening on this address: ::1

This is normal, you can leave this as it is. It means that the redis service is listening on all connections. This also brings a dangerous fact: it allows everyone to connect to your redis server (if the firewall allows this).

By default, the port 6379 (the default redis port) is closed. You have 2 options to protect the redis server.

Note: If you're using AWS, you will also have to edit the security rules group inside AWS itself, to open up port 6379.

Allow from explicit IP address

Allow the port 6379 inside the firewall with an explicit IP address where the connection comes from:

Using a password

Of course in this case you will also have to open up port 6379, which is also possible with an explicit IP address. Set a password inside the redis configuration, you can do this by editing the /etc/redis/redis.conf file.

You can specify a password using the requirepass key inside the configuration file. It is recommended to use a long string random string, an example:

requirepass VT0rZuyWBPd5UL5M3TGR

Next test if you can connect to your redis server with a remote application. A Laravel example inside the .env file could look like this:


We also have a sample installation for you to test if you're able to connect to your redis server remotely. You can clone this project from here:

05 October 2020 (last updated 3 years ago)


Written by Dennis

Dennis brings over 6 years of hands-on experience in server management, specializing in optimizing web services for scalability and security.

Back to Redis server

Also interesting

Start free trial