VPS Tutorials
Redis Won't Connect on a VPS (2026): Troubleshooting Port 6379, bind, protected-mode, and Service Startup Failures
When Redis won't connect on a VPS, common causes include the service not starting, 6379 not listening, bind restricted to localhost, protected-mode blocking, password/ACL mismatch, firewall or security group blocking, and persistence file permissions causing startup failure. This article troubleshoots layer by layer: local ping, service status, logs, listening address, authentication, and secure exposure.

Redis Won't Connect on a VPS (2026): Troubleshooting Port 6379, bind, protected-mode, and Service Startup Failures
When Redis won't connect on a VPS, you can't just check whether "the port is open." It may be stuck because the service isn't running, 6379 isn't listening, bind only binds to localhost, protected-mode is blocking, the password or ACL doesn't match, or it could be a firewall, security group, Docker port mapping, or persistence file permission issue.
More importantly: Redis should not be left exposed directly on the public internet. When troubleshooting connection problems, the goal is not to open 0.0.0.0:6379 to everyone, but to confirm the application can connect reliably with minimal exposure.
Common errors can be roughly categorized:
| Symptom | More likely problem |
|---|---|
Connection refused | Redis not started, port not listening, wrong listening address |
Connection timed out | UFW, security group, or network path blocking |
NOAUTH Authentication required | Password/ACL enabled but client didn't send authentication |
DENIED Redis is running in protected mode | protected-mode blocking remote access |
| Service keeps restarting | Configuration error, permission error, memory or persistence file issue |
First run this on the VPS itself:
redis-cli ping
sudo systemctl status redis-server --no-pager
If local PING doesn't even return PONG, troubleshoot the service itself first; if local works but the application or remote connection fails, then troubleshoot the listening address, firewall, and authentication.
On Ubuntu / Debian the common service name is redis-server:
sudo systemctl status redis-server --no-pager
sudo journalctl -u redis-server -n 100 --no-pager
If the service fails to start, focus on these signals:
- Configuration file syntax error;
- Port 6379 is occupied;
- RDB / AOF file directory permission error;
- Disk full, preventing writes;
- Insufficient memory or OOM;
- Docker volume mount directory permissions incorrect.
Confirm the Redis version and configuration file location:
redis-server --version
redis-cli CONFIG GET dir
redis-cli CONFIG GET dbfilename
Redis official documentation also notes: Redis can start without a configuration file, but for production use you should manage configuration via redis.conf; runtime changes to CONFIG SET are not necessarily written back to the configuration file and may be lost after a restart.
sudo ss -lntup | grep 6379
Common results:
127.0.0.1:6379
0.0.0.0:6379
If it only listens on 127.0.0.1:6379, only the local machine can connect. For applications on the same machine, this is the recommended state; for remote applications, you need access via an internal network, tunnel, or controlled whitelist.
Local test:
redis-cli -h 127.0.0.1 -p 6379 ping
If this works but remote doesn't, the problem is usually in bind, protected-mode, the firewall, security group, or client authentication.
Common configuration file:
/etc/redis/redis.conf
Check the key items:
grep -E '^(bind|protected-mode|requirepass|port)' /etc/redis/redis.conf
Security recommendation:
bind 127.0.0.1 ::1
protected-mode yes
If the application and Redis are on the same VPS, do not change it to 0.0.0.0. If cross-machine access is truly needed, prefer an internal IP or VPN network, for example:
bind 127.0.0.1 10.0.0.8
protected-mode yes
Restart after changes:
sudo systemctl restart redis-server
Check listening again:
sudo ss -lntup | grep 6379
If Redis has a password enabled, the client must send authentication. Common legacy configuration:
requirepass 强密码
Redis 6+ may also use ACL. Check ACL:
redis-cli ACL LIST
Test with password:
redis-cli -a '你的密码' ping
A safer approach is to avoid leaving the password in shell history; you can temporarily use environment variables or interactive input.
Common application connection string format:
redis://:[email protected]:6379/0
If NOAUTH appears in application logs, Redis requires authentication but the client didn't send it; if WRONGPASS appears, the password or user doesn't match.
Local firewall:
sudo ufw status verbose
If only allowing fixed source IPs:
sudo ufw allow from 203.0.113.10 to any port 6379 proto tcp
Do not casually run:
sudo ufw allow 6379/tcp
Unless you have already restricted sources in the cloud security group and confirmed the business truly requires remote access.
Test the port from the client:
nc -vz VPS公网IP 6379
If the port is unreachable, troubleshoot the network layer first; if the port is reachable but authentication fails, then troubleshoot the Redis configuration.
If Redis runs in Docker:
docker ps
Check whether PORTS contains:
127.0.0.1:6379->6379/tcp
For production, binding to localhost is more recommended:
services:
redis:
image: redis:7-alpine
ports:
- "127.0.0.1:6379:6379"
command: ["redis-server", "--appendonly", "yes"]
volumes:
- redis-data:/data
If the container keeps restarting, check the logs:
docker logs --tail=100 容器名
Volume permissions, AOF/RDB write failures, and low memory limits can all prevent Redis from starting.
Recommended order:
redis-cli pinglocal test;systemctl status redis-servercheck the service;journalctl -u redis-server -n 100check the logs;ss -lntup | grep 6379check the listening address;- Check
bind,protected-mode,requirepass, ACL; - Check UFW and cloud security groups;
- For Docker scenarios, check
portsand volumes; - Finally, change the application connection string.
Redis is suited to sit next to the application, not to be exposed directly to the public internet. Safer connection methods:
- Same-machine application: listen on
127.0.0.1; - Same-cloud internal network: listen on internal IP;
- Remote management: SSH tunnel;
- Multi-machine access: WireGuard / Tailscale / ZeroTier;
- Temporary troubleshooting: security group allows only fixed IPs, close it when done.
Further reading:
When Redis won't connect on a VPS, the most common cause is not a single issue but a combination of listening address, protected-mode, authentication, firewall, and application connection string. Start with local redis-cli ping, then troubleshoot layer by layer up to remote access. Don't open 6379 to the whole internet just to "get connected"—once Redis is exposed to the public internet, the risk is far higher than a single connection failure.