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

相关推荐
Johny_Zhao5 小时前
Keepalived与Nginx架构选型
linux·nginx·信息安全·云计算·apache·shell·yum源·keepalive·系统运维
FlightYe7 小时前
linux系统编程(二十一):C 语言常见坑
android·linux·运维·服务器·c语言·音视频
by209998 小时前
Linux 文件描述符与重定向
linux·服务器
橙橙笔记8 小时前
Linux基础与命令的学习
linux·运维·服务器·shell
无奈笑天下8 小时前
银河麒麟桌面操作系统【命令行配置文件与图片搜索功能】操作方法
linux·运维·服务器
飞花漫卷,情随岁迁9 小时前
网络数据包转发与内核机制:小白概念科普
linux·运维·网络·数据库·mysql·oracle·智能路由器
.道阻且长.10 小时前
Linux基础IO:理解文件以及回顾C文件接口
linux·运维·服务器·c语言·开发语言·职场和发展
学以智用11 小时前
CentOS 目录穿梭
linux
goehou12 小时前
改错一行 fstab,SSH 就再也连不上了
linux·运维·故障恢复·fstab
Csvn13 小时前
Nginx 可观测性与工程化:指标、告警与发布回滚演练
后端·nginx