wordpress部署nginx版的

一、通过nginx部署wordpress

1、用yum源安装nginx

yum install -y nginx

2、安装php相关软件

前提安装webtatic

rpm -Uvh https://mirror.webtatic.com/yum/el7/webtatic-release.rpm

通过yum源安装php相关软件

yum -y install php72w php72w-pdo php72w-mysqlnd php72w-opacache php72w-xml php72w-gd php72w-mcrypt php72w-devel php72w-intl php72w-mbstring php72w-bcmatch php72w-json php72w-iconv php72w-fpm

加入全局环境变量

systemctl enable php-fpm.service

启动php服务

systemctl start php-fpm.service

3、编辑nginx配置文件

在nginx配置文件加入以下配置

location / {

index index.php index.html index.htm;

}

location ~\.php$ {

fastcgi_pass 127.0.0.1:9000;

fastcgi_index index.php;

fastcgi_param SCRIPT_FILENAME /usr/share/nginx/html$fastcgi_script_name;

include fastcgi_params;

}

启动nginx

nginx -t

systemctl start nginx php-fpm

systemctl enable nginx php-fpm

4、下载wordpress安装包

下载wordpress-5.4.5-zh_CN.zip

并将安装包放在/usr/share/nginx/html 目录下

unzip wordpress-5.4.5-zh_CN.zip。 解压这个安装包

并赋予wordpress权限chmod -R 777 wordpress

进入wordpress目录。 cd wordpress

cp wp-config-sample.php wp-config.php

配置数据库连接信息。 vim wp-config.php

二、完成与redis对接 安装redis 插件

yum install http://rpms.remirepo.net/enterprise/remi-release-7.rpm -y

yum install --enablerepo=remi --enablerepo=remi-php72 php php-opcache php-devel php-mysqlnd php-gd php-redis -y

redis相关配置

vim /usr/share/nginx/html/wp-config.php

添加如下配置

define("FS_METHOD","direct");

define("FS_CHMOD_DIR",0777);

define("FS_CHMOD_FILE",0777);

define('WP_REDIS_CLIENT','pecl');

define('WP_REDIS_SCHEME','tcp');

define('WP_REDIS_HOST','192.168.1.204');

define('WP_REDIS_PORT','6379');

define('WP_REDIS_DATABASE','0');

define('WP_REDIS_PASSWORD','Hwcloud@123');

相关推荐
匆匆那年96718 小时前
llamafactory推理消除模型的随机性
linux·服务器·学习·ubuntu
好好学习天天向上~~18 小时前
5_Linux学习总结_vim
linux·学习·vim
馨谙18 小时前
Ansible模块化Playbook管理:静态导入与动态包含详解
运维·ansible
聆风吟º1 天前
CANN开源项目深度实践:基于amct-toolkit实现自动化模型量化与精度保障策略
运维·开源·自动化·cann
Coder个人博客1 天前
Linux6.19-ARM64 mm mmu子模块深入分析
大数据·linux·车载系统·系统架构·系统安全·鸿蒙系统
较劲男子汉1 天前
CANN Runtime零拷贝传输技术源码实战 彻底打通Host与Device的数据传输壁垒
运维·服务器·数据库·cann
Doro再努力1 天前
Vim 快速上手实操手册:从入门到生产环境实战
linux·编辑器·vim
wypywyp1 天前
8. ubuntu 虚拟机 linux 服务器 TCP/IP 概念辨析
linux·服务器·ubuntu
风流倜傥唐伯虎1 天前
Spring Boot Jar包生产级启停脚本
java·运维·spring boot
Doro再努力1 天前
【Linux操作系统10】Makefile深度解析:从依赖推导到有效编译
android·linux·运维·服务器·编辑器·vim