centos7部署Wordpress

      • 1.LNMP环境部署
      • 2.为Wordpress创建数据库
      • 3.下载Wordpress
      • 4.修改服务配置文件
      • 5.访问并配置
      • 6.主题安装
      • 7.插件安装

1.LNMP环境部署

centos7版本 :CentOS Linux release 7.5.1804 
nginx版本: nginx/1.20.1
mysql版本: 5.7.38
php版本:7.4.30 
WordPress版本:6.0

执行命令部署lnmp
wget http://soft.vpser/lnmp/lnmp1.9.tar.gz -cO lnmp1.9.tar.gz && tar zxf lnmp1.9.tar.gz && cd lnmp1.9 && ./install.sh lnmp

*注意selinux
*注意防火墙,注意防火墙上端口的配置
*如果是在ECS上部署,注意安全组上的端口配置

2.为Wordpress创建数据库

进入数据库
mysql -uroot -p回车输入密码

创建数据库
create database wordpress;

创建用户用于管理Wordpress数据库
create user 'wordpress'@'localhost' identified by '1Q2w3e4r5t.';

赋予用户对数据库wordpress的全部权限
grant all privileges on wordpress.* to 'wordpress'@'localhost' identified by '1Q2w3e4r5t.';

使配置生效。
flush privileges;

退出MySQL。
exit;

3.下载Wordpress

下载Wordpress
wget https://cn.wordpress/latest-zh_CN.tar.gz

将默认文件移到其他目录
mv /usr/local/nginx/html/*.html /tmp

解压包到指定目录
tar -zxf latest-zh_CN.tar.gz -C /usr/local/nginx/html

4.修改服务配置文件

修改nginx配置文件,指定网站根目录
vim /usr/local/nginx/conf/nginx.conf

重启nginx
systemctl restart nginx

修改WordPress配置文件
重命名配置文件
mv wp-config-sample.php wp-config.php

修改配置文件
vim /usr/local/nginx/html/wordpress/wp-config.php

/** WordPress数据库的名称 */
define('DB_NAME', '这里填数据库名称');

/** MySQL数据库用户名 */
define('DB_USER', '这里填管理Wordpress数据库的用户');

/** MySQL数据库密码 */
define('DB_PASSWORD', '这里填数据库的密码');

/** MySQL主机 */
define('DB_HOST', 'localhost');

5.访问并配置

浏览器访问http://主机IP地址:80,出现以下界面
按照提示配置即可

6.主题安装

服务器上主题的存放路径一般在:/wordpress/wp-content/themes,可以把解压后的包传到该路径

点击外观-主题-安装主题

可以选择主题进行安装,也可以自行上传主题

7.插件安装

服务器上插件的存放路径一般在:/wordpress/wp-content/plugins,可以把解压后的包传到该路径

可以搜索需要的插件安装,或者上传下载好的插件

更多推荐

centos7部署Wordpress