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\redis\Connection',
'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',
],
posted @ 2019-05-06 11:44  llxpbbs  阅读(849)  评论(0编辑  收藏  举报