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 小时前
Ubuntu Linux Cursor 安装与使用一
linux·运维·ubuntu
艾伦_耶格宇2 小时前
【ACP】阿里云云计算高级运维工程师--ACP
运维·阿里云·云计算
一位摩羯座DBA3 小时前
Redhat&Centos挂载镜像
linux·运维·centos
学习3人组3 小时前
CentOS配置网络
linux·网络·centos
charlee443 小时前
nginx部署发布Vite项目
nginx·性能优化·https·部署·vite
weixin_307779133 小时前
Hive集群之间迁移的Linux Shell脚本
大数据·linux·hive·bash·迁移学习
漫步企鹅4 小时前
【蓝牙】Linux Qt4查看已经配对的蓝牙信息
linux·qt·蓝牙·配对
cui_win4 小时前
【网络】Linux 内核优化实战 - net.core.flow_limit_table_len
linux·运维·网络
梦在深巷、4 小时前
MySQL/MariaDB数据库主从复制之基于二进制日志的方式
linux·数据库·mysql·mariadb
风清再凯4 小时前
自动化工具ansible,以及playbook剧本
运维·自动化·ansible