|
本帖最后由 freeloop 于 2025-5-23 17:28 编辑
为大家分享如何搭建WordPress站点,示例为CentOS7
1.首先须完成搭建LNMP环境,可参考【Linux如何搭建LNMP环境】
2.进入数据库
3.创建MariaDB数据库命名为“wordpress”
- CREATE DATABASE wordpress;
复制代码
4.创建新用户“user”,密码为test123
- CREATE USER 'user'@'localhost' IDENTIFIED BY 'test123';
复制代码
5.赋予“user”用户对 “wordpress” 数据库的全部权限
- GRANT ALL PRIVILEGES ON wordpress.* TO 'user'@'localhost';
复制代码
6.使配置生效
7.删除index.php文件,之前用于验证测试PHP-Nginx配置
- rm -rf /usr/share/nginx/html/index.php
复制代码
8.下载并解压WordPress
- wget https://cn.wordpress.org/wordpress-6.6.1-zh_CN.tar.gz
复制代码- tar zxvf wordpress-6.6.1-zh_CN.tar.gz
复制代码
9.将wp-config-sample.php文件复制到wp-config.php文件中,并备份示例文件
- cd /usr/share/nginx/html/wordpress
复制代码- cp wp-config-sample.php wp-config.php
复制代码
10.创建新的配置文件
11.将以下Mysql内容修改并覆盖
- // ** MySQL settings - You can get this info from your web host ** //
- /** The name of the database for WordPress */
- define('DB_NAME', 'wordpress');
- /** MySQL database username */
- define('DB_USER', 'user');
- /** MySQL database password */
- define('DB_PASSWORD', '123456');
- /** MySQL hostname */
- define('DB_HOST', 'localhost');
复制代码
12.打开浏览器,输入您的云服务器公网IP地址进入wordpress文件夹,验证wordpress站点是否安装成功
- http://您的云服务器公网IP地址/wordpress
复制代码
|
|