WordPress是一套利用PHP语言和MySQL数据库开发的开源免费Blog(博客,网站)程序,用户可以在支持PHP环境和MySQL数据库的服务器上建立Blog站点,它的功能非常强大,插件众多,易于扩充功能,其安装和使用也特别方便,目前WordPress已经成为主流的Blog 搭建平台。
首先进行MySQL数据库的配置准备
[root@web1 mysql]# mysql -uroot -p #登录数据库
Enter password: #注意密码一定要输入正确 WANGju123
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 24
Server version: 5.7.26 MySQL Community Server (GPL)
Copyright (c) 2000, 2019, Oracle and/or its affiliates. All rights reserved.
Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
wangju [(none)]>create database wordpress; #创建一个数据库
Query OK, 1 row affected (0.21 sec)
wangju [(none)]>show databases like 'wordpress'; #查看创建的数据库
+----------------------+
| Database (wordpress) |
+----------------------+
| wordpress |
+----------------------+
1 row in set (0.12 sec)
wangju [(none)]>grant all on wordpress.* to wordpress@'localhost' identified by '123456'; #创建一个专用的WordPress Blog管理用户
Query OK, 0 rows affected, 1 warning (0.13 sec)
wangju [(none)]>flush privileges; #刷新数据,不是必须的一步
Query OK, 0 rows affected (0.56 sec)
wangju [(none)]>show grants for wordpress@'localhost'; #查看用户对应的权限
+------------------------------------------------------------------+
| Grants for wordpress@localhost |
+------------------------------------------------------------------+
| GRANT USAGE ON *.* TO 'wordpress'@'localhost' |
| GRANT ALL PRIVILEGES ON `wordpress`.* TO 'wordpress'@'localhost' |
+------------------------------------------------------------------+
2 rows in set (0.00 sec)
wangju [(none)]>select user,authentication_string,host from mysql.user; #查看用户列表命令
+---------------+-------------------------------------------+-----------+
| user | authentication_string | host |
+---------------+-------------------------------------------+-----------+
| root | *2145DDAC91291B14D18A7DDB57E33BD31A7CA3BF | localhost |
| mysql.session | *THISISNOTAVALIDPASSWORDTHATCANBEUSEDHERE | localhost |
| mysql.sys | *THISISNOTAVALIDPASSWORDTHATCANBEUSEDHERE | localhost |
| wordpress | *6BB4837EB74329105EE4568DDA7DC67ED2CA2AD9 | localhost |
+---------------+-------------------------------------------+-----------+
4 rows in set (0.00 sec)
wangju [(none)]>quit #退出数据库
Bye
其次配置支持LNMP的PHP文件(可参考LNMP环境搭建二)
[root@web1 extra]# vim 03_blog.conf
server {
listen 80;
server_name blog.etiantian.org;
location / {
root html/blog;
index index.php index.html index.htm; #补充一个首页文件index.php在前面
}
location ~ .*\.(php|php5)?$ {
root html/blog;
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
include fastcgi.conf;
}
}
[root@web1 extra]# ../../sbin/nginx -t #配置完成后进行常规检查
nginx: the configuration file /application/nginx-1.16.0//conf/nginx.conf syntax is ok
nginx: configuration file /application/nginx-1.16.0//conf/nginx.conf test is successful
[root@web1 extra]# ../../sbin/nginx -s reload
获取WordPress博客程序,并放在Blog域名对应的虚拟主机的站点目录下,即html/blog
[root@web1 extra]# cd ../../html/blog/ #首先在官网上下载文件wordpress-5.7.2.tar.gz,然后传到Linux系统中
[root@web1 blog]# rz -E #文件传送
rz waiting to receive.
[root@web1 blog]# ls
index.html test_info.php test_mysql.php wordpress-5.7.2.tar.gz
[root@web1 blog]# ls -lsh wordpress-5.7.2.tar.gz
16M -rw-r--r-- 1 root root 16M 7月 3 17:23 wordpress-5.7.2.tar.gz
[root@web1 blog]# tar xf wordpress-5.7.2.tar.gz #解压文件
[root@web1 blog]# ls
index.html test_info.php test_mysql.php wordpress wordpress-5.7.2.tar.gz
[root@web1 blog]# mv wordpress/* . #把程序内容移动到blog根目录
[root@web1 blog]# /bin/mv wordpress-5.7.2.tar.gz /home/wangju/tools/ #移走源程序备份
[root@web1 blog]# chown -R nginx.nginx ../blog/ #授权Nginx及PHP服务可以访问Blog站点目录
支持,准备工作做好了,接下来,我们准备安装博客程序,在浏览器中输入"blog.etiantian.org" ,选择语言为简体中文,即可看到下图
点击“现在就开始”按钮,在出现的表单中填写相应的内容
填好内容点击提交
点击运行安装程序
点击安装WordPress
点击登录即可登录到博客的管理后台 ,记得输入正确的用户及密码,即可进入
点击如下图所示的地方,即可编辑文章
文章编辑好之后,点击右上角的发布即可
发布完成之后,单击查看文章即可。
这里,便可以看到自己发布的文章,至于WordPress的其他的功能,需要大家自己慢慢挖掘。ヾ(◍°∇°◍)ノ゙