使用Wordpress搭建个人博客网站

版权声明:本文为博主原创文章,遵循 CC 4.0 BY-SA 版权协议,转载请附上原文出处链接和本声明。
本文链接: https://blog.csdn.net/Powerful_Fy/article/details/102526328

前面几篇文章已经介绍了怎么在Linux下搭建LNMP环境:

1.安装MySQL/MariaDB

2.安装PHP

3.安装Nginx

4.nginx配置虚拟主机

接下来开始使用workpress搭建个人博客网站:

workpress官网:https://cn.wordpress.org/

下载workpress:

[root@linux ~]# wget https://cn.wordpress.org/latest-zh_CN.tar.gz

解压:

[root@linux ~]# tar -zxvf latest-zh_CN.tar.gz 

创建博客网站目录:

[root@linux ~]# mkdir -p /data/www/test.blog.com

将workpress安装包中的文件移动到博客网站目录下:

[root@linux ~]# mv wordpress/* /data/www/test.blog.com/

修改nginx虚拟主机配置文件:

[root@linux ~]# vi /etc/nginx/conf.d/default.conf 

修改以下内容:
在这里插入图片描述
1.定义博客网站的自定义域名(如有真实域名可以使用真实域名)
2.定义博客网站的目录
3.添加index.php(WordPress使用的是php)
4.将该配置文件底部的php段内容的注释符号#去掉,定义网站的目录
5.修改/scripts为网站目录路径

验证配置文件并重载:

[root@linux ~]# nginx -t
nginx: the configuration file /etc/nginx/nginx.conf syntax is ok
nginx: configuration file /etc/nginx/nginx.conf test is successful
[root@linux ~]# nginx -s reload

Windows上修改hosts文件内容为:
在这里插入图片描述
打开浏览器访问test.blog.com:
在这里插入图片描述
#wordpress的页面已成功显示

接下来创建博客网站的数据库:

登录:

[root@linux ~]# mysql -uroot -p123456
Welcome to the MariaDB monitor.  Commands end with ; or \g.
Your MariaDB connection id is 12
Server version: 10.3.18-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)]> 

创建数据库:

MariaDB [(none)]> create database wordpress;
Query OK, 1 row affected (0.000 sec)

创建用户:

MariaDB [(none)]> grant all on wordpress.* to 'blog'@'127.0.0.1' identified by 'test123';
Query OK, 0 rows affected (0.029 sec)

#创建用户blog,密码test123,授权从127.0.0.1连接

修改网站目录文件的属主:

[root@linux ~]# cd /data/www/test.blog.com/
[root@linux test.blog.com]# chown -R php-fpm .

打开浏览器访问test.blog.com开始配置数据库信息:
在这里插入图片描述
#输入好数据库信息点击提交即可

开始安装:
在这里插入图片描述
#定义网站标题,用户名,密码(邮件地址必填,但未配置邮件服务不会发邮件)

填写完成后点击安装,显示成功:
在这里插入图片描述
再次访问自定义的域名test.blog.com即可显示出博客页面:
在这里插入图片描述
在页面下方点击登录后进入后台管理页面:
在这里插入图片描述
接下来就可以自由编辑博客的主页排版、外观样式、权限等设置了。

猜你喜欢

转载自blog.csdn.net/Powerful_Fy/article/details/102526328