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');

相关推荐
深紫色的三北六号1 小时前
Linux 服务器磁盘扩容与目录迁移:rsync + bind mount 实现服务无感迁移(无需修改配置)
linux·扩容·服务迁移
SudosuBash5 小时前
[CS:APP 3e] 关于对 第 12 章 读/写者的一点思考和题解 (作业 12.19,12.20,12.21)
linux·并发·操作系统(os)
哈基咪怎么可能是AI15 小时前
为什么我就想要「线性历史 + Signed Commits」GitHub 却把我当猴耍 🤬🎙️
linux·github
十日十行1 天前
Linux和window共享文件夹
linux
木心月转码ing2 天前
WSL+Cpp开发环境配置
linux
蝎子莱莱爱打怪3 天前
Centos7中一键安装K8s集群以及Rancher安装记录
运维·后端·kubernetes
崔小汤呀3 天前
最全的docker安装笔记,包含CentOS和Ubuntu
linux·后端
何中应3 天前
vi编辑器使用
linux·后端·操作系统
何中应3 天前
Linux进程无法被kill
linux·后端·操作系统