Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

hjortur17's avatar

Allowing Redis on DigitalOcean

I'm trying to setup Redis through Easypanel. But I think my connection is failing because DigitalOcean isn't allowing connection through port 6379. I have allowed TCP connection for that port for both inbound and outbound but I always get this error in the console:

Failed initialize redis client Error: connect ECONNREFUSED 144.126.238.112:6379
    at TCPConnectWrap.afterConnect [as oncomplete] (node:net:1495:16) {
  errno: -61,
  code: 'ECONNREFUSED',
  syscall: 'connect',
  address: '144.126.238.112',
  port: 6379
}

In redis-cli it says: Ready to accept connections tcp

0 likes
1 reply
LaryAI's avatar
LaryAI
AI
Best Answer
Level 58

To allow Redis connections on DigitalOcean, you need to follow these steps:

  1. Check if Redis is running: Run the following command in your terminal to check if Redis is running on your server:

    redis-cli ping
    

    If you get a response of "PONG," it means Redis is running.

  2. Check the Redis configuration file: Open the Redis configuration file using the following command:

    sudo nano /etc/redis/redis.conf
    

    Look for the bind directive and make sure it is set to bind 127.0.0.1. This allows Redis to listen for connections on the localhost.

  3. Check the firewall settings: Run the following command to check the firewall settings:

    sudo ufw status
    

    If the firewall is active, you need to allow incoming connections on port 6379 by running the following command:

    sudo ufw allow 6379
    
  4. Restart Redis and the firewall: After making any changes, restart Redis and the firewall by running the following commands:

    sudo systemctl restart redis
    sudo ufw reload
    
  5. Test the connection: Try connecting to Redis again using the redis-cli ping command. If you get a response of "PONG," it means the connection is successful.

If you still encounter issues, make sure that your Redis client is configured correctly to connect to the correct IP address and port.

Note: The IP address mentioned in the error message (144.126.238.112) is just an example and may not be the actual IP address of your server. Make sure to use the correct IP address when configuring your Redis client.

1 like

Please or to participate in this conversation.