我正在使用 php-redis 作为 session 管理器,但我遇到了一个奇怪的问题。
我在一台 Centos 6.4 机器上运行 php,在另一台服务器上我有 redis,所以如果我禁用 php 机器的防火墙,一切正常。
但是一旦我启动iptables,php-redis 就无法连接到redis 服务器。
我当然有一个规则,但显然是行不通的:
iptables -A INPUT -p tcp --dport 6379 -j ACCEPT;
我已重新启动 iptables 并正确检查规则是否已应用。有人知道这是怎么回事吗?
最佳答案
你试过吗?
iptables -N REDIS
iptables -A REDIS -s localhost -j 接受
iptables -A REDIS -s 127.0.0.1 -j 接受
iptables -A REDIS -j LOG --log-prefix "unauth-redis-access"
iptables -A REDIS -j 拒绝 --reject-with icmp-port-unreachable
iptables -I INPUT -p tcp --dport 6379 -j REDIS
https://serverfault.com/questions/532075/redis-no-route-to-host-when-pinging-a-remote-redis-host
关于Php Redis 连接问题,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/18523644/