网络技能大赛-云平台部分-CentOS部分11-[wordpress]

网络技能大赛-云平台部分-CentOS部分11-[wordpress]

2022年全国职业技能大赛网络系统管理赛项相较2021年再次做出改动,Linux部分从之前的Debian又换回了CentOS,不过相应增加了UOS国产操作系统。
再怎么变比赛的东西也就那么多,希望大家都能勇于动手尝试,多多摸索,愿大家都能取得一个理想的成绩!
交流共享资料群号:926132419

配置wordpress站点
  • 站点访问URL为:https://www.rj.com/wordpress
  • 站点名称为rj
#由于/data/web_data目录是从serverA上挂载的 wordpress需要上传到serverA的/data/web_data
#然后从serverB的/data/web_data文件夹进行访问

在这里插入图片描述

#在配置前由于在serverA上用nfs挂载过来的 需要让serverA远程连接上serverB
#先在serverA上再对mariadb进行配置
[root@serverB wordpress]# mysql -u root -p
Enter password: 
Welcome to the MariaDB monitor.  Commands end with ; or \g.
Your MariaDB connection id is 6
Server version: 5.5.60-MariaDB MariaDB Server

Copyright (c) 2000, 2018, Oracle, MariaDB Corporation Ab and others.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

MariaDB [(none)]> use mysql;
Reading table information for completion of table and column names
You can turn off this feature to get a quicker startup with -A

Database changed
MariaDB [mysql]> UPDATE user SET password=password('123456') WHERE user='root';
Query OK, 4 rows affected (0.00 sec)
Rows matched: 4  Changed: 4  Warnings: 0

MariaDB [mysql]> flush privileges;
Query OK, 0 rows affected (0.00 sec)

MariaDB [mysql]> exit
Bye
[root@serverB wordpress]# mysql -u root -p
Enter password: 
ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: NO)
[root@serverB wordpress]# mysql -u root -p
Enter password: 
Welcome to the MariaDB monitor.  Commands end with ; or \g.
Your MariaDB connection id is 8
Server version: 5.5.60-MariaDB MariaDB Server

Copyright (c) 2000, 2018, Oracle, MariaDB Corporation Ab and others.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

MariaDB [(none)]> Ctrl-C -- exit!
Aborted
[root@serverB wordpress]# mysql -u root -p
Enter password: 
Welcome to the MariaDB monitor.  Commands end with ; or \g.
Your MariaDB connection id is 10
Server version: 5.5.60-MariaDB MariaDB Server

Copyright (c) 2000, 2018, Oracle, MariaDB Corporation Ab and others.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

MariaDB [(none)]> GRANT ALL PRIVILEGES ON *.* TO 'root'@'192.168.110.%'IDENTIFIED BY '123456' WITH GRANT OPTION;
Query OK, 0 rows affected (0.00 sec)

MariaDB [(none)]> flush privileges;
Query OK, 0 rows affected (0.00 sec)

MariaDB [(none)]> 

#在serverA上进行远程连接测试
[root@serverA wordpress]# mysql -u root -p123456 -h 192.168.110.33
Welcome to the MariaDB monitor.  Commands end with ; or \g.
Your MariaDB connection id is 11
Server version: 5.5.60-MariaDB MariaDB Server

Copyright (c) 2000, 2018, Oracle, MariaDB Corporation Ab and others.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

MariaDB [(none)]> show databases;
+--------------------+
| Database           |
+--------------------+
| information_schema |
| mysql              |
| performance_schema |
| test               |
| wordpress          |
+--------------------+
5 rows in set (0.00 sec)

MariaDB [(none)]> 

在这里插入图片描述

#在serverA上修改wordpress配置文件
[root@serverA wordpress]# cp -p wp-config-sample.php wp-config.php
[root@serverA wordpress]# vim wp-config.php 
[root@serverA wordpress]# cat wp-config.php 
<?php
/** 
 * WordPress 基础配置文件。
 *
 * 本文件包含以下配置选项:MySQL 设置、数据库表名前缀、密匙、
 * WordPress 语言设定以及 ABSPATH。如需更多信息,请访问
 * {@link http://codex.wordpress.org/zh-cn:%E7%BC%96%E8%BE%91_wp-config.php
 * 编辑 wp-config.php} Codex 页面。MySQL 设置具体信息请咨询您的空间提供商。
 *
 * 这个文件用在于安装程序自动生成 wp-config.php 配置文件,
 * 您可以手动复制这个文件,并重命名为“wp-config.php”,然后输入相关信息。
 *
 * @package WordPress
 */

// ** MySQL 设置 - 具体信息来自您正在使用的主机 ** //
/** WordPress 数据库的名称 */
define('DB_NAME', 'wordpress');

/** MySQL 数据库用户名 */
define('DB_USER', 'root');

/** MySQL 数据库密码 */
define('DB_PASSWORD', '123456');

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

/** 创建数据表时默认的文字编码 */
define('DB_CHARSET', 'utf8');

/** 数据库整理类型。如不确定请勿更改 */
define('DB_COLLATE', '');

在这里插入图片描述

#如果出现下面的错误要先安装php-mysql扩展
#然后重启web服务器
[root@serverB wordpress]# yum install php-mysql -y
[root@serverB wordpress]# systemctl restart httpd

在这里插入图片描述
在这里插入图片描述

#先在电脑上加入DNS
#然后在浏览器中直接访问域名即可

在这里插入图片描述
在这里插入图片描述

在这里插入图片描述

在这里插入图片描述

  • 2
    点赞
  • 4
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值