安装部署lnmp+redis

配置仓库:

# yum install epel-release

安装配置:

# yum install nginx php php-devel php-fpm php-mysql php-redis mariadb mariadb-server mariadb-devel 

启动数据库服务:

# systemctl start mariadb

通过MySQL客户端命令连接数据库服务:
创建数据库:

MariaDB [(none)]> create database discuz charset utf8; 
  Query OK, 1 row affected (0.00 sec) 

MariaDB [(none)]> grant all on discuz.* to "discuz"@localhost identified  by "123456"; 
  Query OK, 0 rows affected (0.00 sec) 

MariaDB [(none)]> flush privileges; 
  Query OK, 0 rows affected (0.00 sec) 

上传网站代码:

# unzip Discuz_X3.1_SC_UTF8.zip -d /usr/share/nginx/html/ 
# chown apache. -R /usr/share/nginx/html/upload/ 

修改nginx配置文件:

vim /etc/nginx/conf.d/default.conf 
    location / { 
        root /usr/share/nginx/html/upload; 
        index index.php index.html index.htm; 
    } 
+-- 17 行: #error_page 404 /404.html;
----------------------------------------------------------------------------------

  location ~ \.php$ { 
    root /usr/share/nginx/html/upload;
    fastcgi_pass 127.0.0.1:9000; 
    fastcgi_index index.php; 
    fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; 
    include fastcgi_params; 
  } 

启动nginx、php-fpm服务:

# systemctl start nginx php-fpm

整合redis:

# yum install redis

修改配置文件:

# grep "^bind" /etc/redis.conf 
    bind 0.0.0.0 

启动redis服务:

# systemctl start redis 

修改discuz网站的配置文件:

# vim /usr/share/nginx/html/upload/config/config_global.php 
---------------------- CONFIG MEMORY ----------------------
$_config['memory']['prefix'] = 'H9CYJk_'; 
$_config['memory']['redis']['server'] = '192.168.75.123'; 
$_config['memory']['redis']['port'] = 6379;

验证缓存:

# redis-cli 
127.0.0.1:6379> keys * 
1) "H9CYJk_cronnextrun" 
2) "H9CYJk_diytemplatenamehome" 
3) "H9CYJk_onlinerecord" 
4) "H9CYJk_diytemplatenameforum" 
5) "H9CYJk_userstats" 

  • 1
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 1
    评论
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值