centos 7.9搭建wordpress

Centos 7.9 搭建 Wordpress

资源版本

操作系统 Centos 7.9
Ngnix版本:1.16.1
数据库: mariadb 5.5.68
PHP:5.4.15

环境配置

Mariadb

yum安装服务器端,默认依赖安装客户端

yum install -y mariadb-server

配置启动并开机自启

systemctl start mariadb
systemctl enable mariadb

初始化mysql的root密码

mysql -u root
set password=PASSWORD(‘密码‘);

创建数据库

create database wordpress;

新创建一个用户

create user 'wdpress'@'localhost' identified by 'wordpress';

赋予该用户wordpress数据库的所有权限

grant all privileges on wordpress.* to 'wdpress'@'localhost' identified by 'wordpress';

配置生效

flush privileges;

PHP

系统自带的,官方源和阿里源都是php5,要安装php7需先添加webtatic源

rpm -Uvh https://mirror.webtatic.com/yum/el7/latest.rpm
yum clean all && yum makecache

Nginx

安装nginx,下载wordpress

yum install nginx
wget https://cn.wordpress.org/wordpress-5.7.2-zh_CN.tar.gz

解压后,移动至nginx目录下

tar -xzvf wordpress-5.7.2-zh_CN.tar.gz
mv wordpress-5.7.2-zh_CN.tar.gz /user/share/nginx/html/

将Wordpress的配置文件软连接至Wordpress目录下

cd /usr/share/nginx/html/wordpress
ln -snf /etc/wordpress/wp-config.php wp-config.php

编辑wordpress配置文件,修改数据库名称,用户名,密码

编辑nginx配置文件,修改root路径

server {
listen80 default_server;
listen[::]:80 default_server;
server_name  _;
root/usr/share/nginx/html/wordpress;

# Load configuration files for the default server block.
include /etc/nginx/default.d/*.conf;

location / {
index index.php;
}

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

重启服务

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值