redis外部连接

redis外部连接

更改redis.conf 文件

bind 127.0.0.1
protected-mode yes
#requirepass 123456

更改为

# bind 127.0.0.1
protected-mode no

requirepass 123456


yii配置
'redis' => [
'class' => 'yii edisConnection',
'hostname' => '127.0.0.1',
'port' => 6379,
'database' => 1,
//'unixSocket' => '/var/run/redis/redis.sock',
'password' => 'rds423fsadD',
// 'unixsocket' => '/var/run/redis/redis.sock',
// 'unixSocket' => '/tmp/redis.sock',
],
原文地址:https://www.cnblogs.com/llxpbbs/p/10818706.html