redis允许远程连接
Redis配置
Redis 配置文件 redis.conf 中有:
bind 127.0.0.1 ::1
protected-mode yes
•bind 127.0.0.1 ::1 限制 Redis 只监听本机 IPv4 和 IPv6 地址。
•protected-mode yes 是保护模式,非本地连接会被拒绝。
这是防止 Redis 被不明网络访问的第一道防线。
修改 bind 地址
找到 redis.conf 中的 bind 配置,将其改为:
bind 0.0.0.0
protected-mode no
设置访问密码(强烈推荐)
为避免安全隐患,添加密码:
requirepass yourStrongPassword
重启 Redis 服务
redis-cli shutdown
redis-server /path/to/redis.conf
#或者通过系统服务重启
sudo systemctl restart redis
防火墙与端口配置
# Linux 示例(以 firewalld 为例)
sudo firewall-cmd --add-port=6379/tcp --permanent
sudo firewall-cmd --reload
    如果这篇文章对你有用,可以关注本人微信公众号获取更多ヽ(^ω^)ノ  ~
 
 


 
 
                
            
         
         浙公网安备 33010602011771号
浙公网安备 33010602011771号