PHP头条
热点:

Ubuntu20.04安装Redis并配置phpRedisAdmin


Redis 官网
https://redis.io/

Redis Quick Start

phpredisadmin 仓库
Gitee 极速下载 / phpredisadmin


apt 安装redis-server


  1. $ sudo apt install redis-server
    确认一下服务状态
    $ sudo service redis-server status

  2. 测试一下
    $ redis-cli

    查询信息,主要看: 版本号,端口,config文件位置
    127.0.0.1:6379> info

    # Serverredis_version:5.0.7...tcp_port:6379...executable:/usr/bin/redis-serverconfig_file:/etc/redis/redis.conf...

    查询密码
    127.0.0.1:6379> config get requirepass

    1) "requirepass"2) ""

  3. 修改配置文件
    $ sudo vim /etc/redis/redis.conf
    重点看 bind 地址、端口号、日志文件位置、密码

    ...# bind 127.0.0.1 ::1# wzh 20210929bind 192.168.0.201 127.0.0.1...# Accept connections on the specified port, default is 6379 (IANA #815344).# If port 0 is specified Redis will not listen on a TCP socket.port 6379...logfile /var/log/redis/redis-server.log...# requirepass foobared...

  4. 重启服务生效
    $ sudo service redis-server restart


安装 phpredisadmin


  1. 抄录一下 2 个安装方法

composer 方式安装

curl -s http://getcomposer.org/installer | phpphp composer.phar create-project -s dev erik-dubbelboer/php-redis-admin path/to/install

手工 clone 方式安装

git clone https://github.com/ErikDubbelboer/phpRedisAdmin.gitcd phpRedisAdmingit clone https://github.com/nrk/predis.git vendor

我这里使用 nginx ,直接将它安装在 /var/www/html 目录下了


  1. 修改配置文件
    $ cd /var/www/html/phpRedisAdmin/
    $ cd includes/

    $ sudo cp config.sample.inc.php config.inc.php

    $ sudo vim config.inc.php
    修改了 2 个地方 : servers 配置 和 http 配置

    $config = array('servers' => array(array('name' => 'local server', // Optional name.'host' => '192.168.0.201', // '127.0.0.1','port' => 6379,'filter' => '*','scheme' => 'tcp', // Optional. Connection scheme. 'tcp' - for TCP connection, 'unix' - for connection by unix domain socket'path' => '', // Optional. Path to unix domain socket. Uses only if 'scheme' => 'unix'. Example: '/var/run/redis/redis.sock''hide' => false, // Optional. Override global setting. Hide empty databases in the database list.// Optional Redis authentication.//'auth' => 'redispasswordhere' // Warning: The password is sent in plain-text to the Redis server.),...// Uncomment to enable HTTP authentication// wzh 20210930'login' => array(// Username => Password// Multiple combinations can be used'admin' => array('password' => '123456',),'guest' => array('password' => '123456','servers' => array(1) // Optional list of servers this user can access.)),...

  2. 在浏览器打开 http://192.168.0.201/phpRedisAdmin/

    curl http://192.168.0.201/phpRedisAdmin/ 没有反应

在这里插入图片描述
输入 用户名 admin ,密码 123456

在这里插入图片描述


错误处理

ubuntu 20.04 上直接 sudo apt install php-fpm 安装的是 php 7.4 版本
总是空白页,也看不到错误提示!

重新安装了 php 7.2 之后就可以了!


www.phpzy.comtrue/phpzx/52034.htmlTechArticleUbuntu20.04安装Redis并配置phpRedisAdmin Redis 官网 https://redis.io/ Redis Quick Start phpredisadmin 仓库 Gitee 极速下载 / phpredisadmin apt 安装redis-server $ sudo apt install redis-server 确认一下服务状态 $ sudo ser...

相关文章

PHP之友评论

今天推荐