目录
1 LNMP组合
1.1 验证Nginx到php的连通性
1.2 验证php到mysql的连通性
2 LNMP之wordpress个人博客搭建
2.1 创建wordpress数据库
2.2 修改blog.conf配置文件
2.3 下载wordpress软件包
2.4 网页安装wordpress
首页 后端开发 php教程 WordPress搭建个人博客

WordPress搭建个人博客

Mar 22, 2018 pm 02:05 PM
wordpress 博客 搭建

本文主要和大家分享WordPress搭建个人博客,主要以图文和代码的形式和大家分享,希望能帮助到大家。

1 LNMP组合

1.1 验证Nginx到php的连通性

在前几篇博文中所有环境都已经配置好了,下面测试Nginx和php之间的连通

LNMP之Nginx服务搭建及三种类型虚拟主机
LNMP之二进制安装mysql-5.5.54
LNMP之源码编译安装php-5.5.32

# 修改/application/nginx/conf/extra/blog.conf[root@web01 extra]# cat blog.conf
    server {        listen       80;
        server_name  blog.rsq.com;
        location / {
            root   html/blog;            index  index.html index.htm;
        }
        location ~ .*\.(php|php5)?$ {
            root html/blog;
        fastcgi_pass 127.0.0.1:9000;
        fastcgi_index index.php;
        include fastcgi.conf;
        }
    }# 重启nginx服务[root@web01 extra]# ../../sbin/nginx -tnginx: the configuration file /application/nginx-1.6.3//conf/nginx.conf syntax is ok
nginx: configuration file /application/nginx-1.6.3//conf/nginx.conf test is successful
[root@web01 extra]# ../../sbin/nginx -s reload# 在/application/nginx/html/blog/目录中写一个phpinfo文件,测试连通性[root@web01 extra]# cd /application/nginx/html/blog/[root@web01 blog]# echo "<?php phpinfo(); ?>" >test_info.php[root@web01 blog]# cat test_info.php<?php phpinfo(); ?>
登录后复制
登录后复制

# windows浏览器中做访问测试,若出现以下页面则测试成功
phpinfo

1.2 验证php到mysql的连通性

# 写一个简单的数据库连接脚本[root@web01 blog]# cat test_mysql.php<?php
    $link_id=mysql_connect(&#39;localhost&#39;,&#39;root&#39;,&#39;oldboy123&#39;) or mysql_error();    if($link_id){        echo "Mysql successful by RSQ !";
    }else{        echo mysql_error();
    }?>
登录后复制
登录后复制

# 浏览器端测试
这里写图片描述

2 LNMP之wordpress个人博客搭建

2.1 创建wordpress数据库

# 先登录mysql,创建WordPress所需要的数据库
[root@web01 ~]# mysql -uroot -poldboy123mysql> show databases;
+--------------------+| Database           |
+--------------------+| information_schema |
| mysql              |
| performance_schema || test               |
+--------------------+4 rows in set (0.01 sec)

mysql> drop database test;          # 删除多余的test数据库
Query OK, 0 rows affected (0.02 sec)mysql> show databases;          #显示数据库
+--------------------+| Database           |
+--------------------+| information_schema |
| mysql              |
| performance_schema |+--------------------+3 rows in set (0.00 sec)

mysql> create database wordpress;           # 创建wordpress用户
Query OK, 1 row affected (0.00 sec)mysql> show databases;
+--------------------+| Database           |
+--------------------+| information_schema |
| mysql              |
| performance_schema || wordpress          |
+--------------------+4 rows in set (0.00 sec)mysql> select user();
+----------------+| user()         |
+----------------+| root@localhost |
+----------------+1 row in set (0.00 sec)mysql> select user,host from mysql.user;        #查看当前数据库用户
+------+-----------+| user | host      |
+------+-----------+| root | 127.0.0.1 |
| root | ::1       |
|      | localhost || root | localhost |
+------+-----------+4 rows in set (0.00 sec)

# 为wordpress数据库创建专门管理的wordpress用户并授予所有权限
mysql> grant all on wordpress.* to wordpress@&#39;localhost&#39; identified by &#39;123456&#39;;        
Query OK, 0 rows affected (0.00 sec)mysql> select user,host from mysql.user;    # 查看wordpress数据库用户是否创建
+-----------+-----------+| user      | host      |
+-----------+-----------+| root      | 127.0.0.1 |
| root      | ::1       |
|           | localhost |
| root      | localhost || wordpress | localhost |
+-----------+-----------+5 rows in set (0.00 sec)
mysql> show grants for wordpress@&#39;localhost&#39;;   # 查看指定用户所具有的权限
mysql> flush privileges;        # 刷新一下,使用户权限生效
Query OK, 0 rows affected (0.00 sec)
登录后复制
登录后复制

2.2 修改blog.conf配置文件

# blog.conf配置文件中index新增index.html[root@web01 extra]# cat blog.conf 
    server {
        listen       80;
        server_name  blog.rsq.com;
        location / {
            root   html/blog;
            index  index.php index.html index.htm;
        }
        location ~ .*\.(php|php5)?$ {
            root html/blog;
        fastcgi_pass 127.0.0.1:9000;
        fastcgi_index index.php;
        include fastcgi.conf;
        }
    }
[root@web01 tools]# /application/nginx/sbin/nginx -t nginx: the configuration file /application/nginx-1.6.3//conf/nginx.conf syntax is oknginx: configuration file /application/nginx-1.6.3//conf/nginx.conf test is successful
[root@web01 tools]# /application/nginx/sbin/nginx -s reload
登录后复制
登录后复制

2.3 下载wordpress软件包

# 先去官网查看所支持插件的版本
这里写图片描述

# 去官网下载最新的wordpress软件包[root@web01 extra]# cd /home/oldboy/tools/[root@web01 tools]# wget https://cn.wordpress.org/wordpress-4.9.4-zh_CN.tar.gz# 解压缩[root@web01 tools]# tar -xf wordpress-4.9.4-zh_CN.tar.gz# 拷贝wordpress目录下的所有内容到/application/nginx/html/blog/目录下[root@web01 tools]# cp -a wordpress/* /application/nginx/html/blog/[root@web01 tools]# ls /application/nginx/html/blog/index.php        wp-blog-header.php    wp-includes        wp-settings.phplicense.txt      wp-comments-post.php  wp-links-opml.php  wp-signup.phpreadme.html      wp-config-sample.php  wp-load.php        wp-trackback.phpwp-activate.php  wp-content            wp-login.php       xmlrpc.phpwp-admin         wp-cron.php           wp-mail.php# 授予权限,先暂时授予所有文件,以后再调整权限[root@web01 tools]# chown -R www.www /application/nginx/html/blog/
登录后复制
登录后复制

2.4 网页安装wordpress

# 客户端 hosts文件要做解析

这里写图片描述

这里写图片描述

这里写图片描述

这里写图片描述

这里写图片描述

这里写图片描述

这里写图片描述

这里写图片描述

———————————————END!

目录



  • 1 LNMP组合

    • 1.1 验证Nginx到php的连通性

    • 1.2 验证php到mysql的连通性

  • 2 LNMP之wordpress个人博客搭建

    • 2.1 创建wordpress数据库

    • 2.2 修改blog.conf配置文件

    • 2.3 下载wordpress软件包

    • 2.4 网页安装wordpress

1 LNMP组合

1.1 验证Nginx到php的连通性

在前几篇博文中所有环境都已经配置好了,下面测试Nginx和php之间的连通

LNMP之Nginx服务搭建及三种类型虚拟主机
LNMP之二进制安装mysql-5.5.54
LNMP之源码编译安装php-5.5.32

# 修改/application/nginx/conf/extra/blog.conf[root@web01 extra]# cat blog.conf
    server {        listen       80;
        server_name  blog.rsq.com;
        location / {
            root   html/blog;            index  index.html index.htm;
        }
        location ~ .*\.(php|php5)?$ {
            root html/blog;
        fastcgi_pass 127.0.0.1:9000;
        fastcgi_index index.php;
        include fastcgi.conf;
        }
    }# 重启nginx服务[root@web01 extra]# ../../sbin/nginx -tnginx: the configuration file /application/nginx-1.6.3//conf/nginx.conf syntax is ok
nginx: configuration file /application/nginx-1.6.3//conf/nginx.conf test is successful
[root@web01 extra]# ../../sbin/nginx -s reload# 在/application/nginx/html/blog/目录中写一个phpinfo文件,测试连通性[root@web01 extra]# cd /application/nginx/html/blog/[root@web01 blog]# echo "<?php phpinfo(); ?>" >test_info.php[root@web01 blog]# cat test_info.php<?php phpinfo(); ?>
登录后复制
登录后复制

# windows浏览器中做访问测试,若出现以下页面则测试成功
phpinfo

1.2 验证php到mysql的连通性

# 写一个简单的数据库连接脚本[root@web01 blog]# cat test_mysql.php<?php
    $link_id=mysql_connect(&#39;localhost&#39;,&#39;root&#39;,&#39;oldboy123&#39;) or mysql_error();    if($link_id){        echo "Mysql successful by RSQ !";
    }else{        echo mysql_error();
    }?>
登录后复制
登录后复制

# 浏览器端测试
这里写图片描述

2 LNMP之wordpress个人博客搭建

2.1 创建wordpress数据库

# 先登录mysql,创建WordPress所需要的数据库
[root@web01 ~]# mysql -uroot -poldboy123mysql> show databases;
+--------------------+| Database           |
+--------------------+| information_schema |
| mysql              |
| performance_schema || test               |
+--------------------+4 rows in set (0.01 sec)

mysql> drop database test;          # 删除多余的test数据库
Query OK, 0 rows affected (0.02 sec)mysql> show databases;          #显示数据库
+--------------------+| Database           |
+--------------------+| information_schema |
| mysql              |
| performance_schema |+--------------------+3 rows in set (0.00 sec)

mysql> create database wordpress;           # 创建wordpress用户
Query OK, 1 row affected (0.00 sec)mysql> show databases;
+--------------------+| Database           |
+--------------------+| information_schema |
| mysql              |
| performance_schema || wordpress          |
+--------------------+4 rows in set (0.00 sec)mysql> select user();
+----------------+| user()         |
+----------------+| root@localhost |
+----------------+1 row in set (0.00 sec)mysql> select user,host from mysql.user;        #查看当前数据库用户
+------+-----------+| user | host      |
+------+-----------+| root | 127.0.0.1 |
| root | ::1       |
|      | localhost || root | localhost |
+------+-----------+4 rows in set (0.00 sec)

# 为wordpress数据库创建专门管理的wordpress用户并授予所有权限
mysql> grant all on wordpress.* to wordpress@&#39;localhost&#39; identified by &#39;123456&#39;;        
Query OK, 0 rows affected (0.00 sec)mysql> select user,host from mysql.user;    # 查看wordpress数据库用户是否创建
+-----------+-----------+| user      | host      |
+-----------+-----------+| root      | 127.0.0.1 |
| root      | ::1       |
|           | localhost |
| root      | localhost || wordpress | localhost |
+-----------+-----------+5 rows in set (0.00 sec)
mysql> show grants for wordpress@&#39;localhost&#39;;   # 查看指定用户所具有的权限
mysql> flush privileges;        # 刷新一下,使用户权限生效
Query OK, 0 rows affected (0.00 sec)
登录后复制
登录后复制

2.2 修改blog.conf配置文件

# blog.conf配置文件中index新增index.html[root@web01 extra]# cat blog.conf 
    server {
        listen       80;
        server_name  blog.rsq.com;
        location / {
            root   html/blog;
            index  index.php index.html index.htm;
        }
        location ~ .*\.(php|php5)?$ {
            root html/blog;
        fastcgi_pass 127.0.0.1:9000;
        fastcgi_index index.php;
        include fastcgi.conf;
        }
    }
[root@web01 tools]# /application/nginx/sbin/nginx -t nginx: the configuration file /application/nginx-1.6.3//conf/nginx.conf syntax is oknginx: configuration file /application/nginx-1.6.3//conf/nginx.conf test is successful
[root@web01 tools]# /application/nginx/sbin/nginx -s reload
登录后复制
登录后复制

2.3 下载wordpress软件包

# 先去官网查看所支持插件的版本
这里写图片描述

# 去官网下载最新的wordpress软件包[root@web01 extra]# cd /home/oldboy/tools/[root@web01 tools]# wget https://cn.wordpress.org/wordpress-4.9.4-zh_CN.tar.gz# 解压缩[root@web01 tools]# tar -xf wordpress-4.9.4-zh_CN.tar.gz# 拷贝wordpress目录下的所有内容到/application/nginx/html/blog/目录下[root@web01 tools]# cp -a wordpress/* /application/nginx/html/blog/[root@web01 tools]# ls /application/nginx/html/blog/index.php        wp-blog-header.php    wp-includes        wp-settings.phplicense.txt      wp-comments-post.php  wp-links-opml.php  wp-signup.phpreadme.html      wp-config-sample.php  wp-load.php        wp-trackback.phpwp-activate.php  wp-content            wp-login.php       xmlrpc.phpwp-admin         wp-cron.php           wp-mail.php# 授予权限,先暂时授予所有文件,以后再调整权限[root@web01 tools]# chown -R www.www /application/nginx/html/blog/
登录后复制
登录后复制

2.4 网页安装wordpress

# 客户端 hosts文件要做解析

这里写图片描述

这里写图片描述

这里写图片描述

这里写图片描述

这里写图片描述

这里写图片描述

这里写图片描述

这里写图片描述

相关推荐:

LAMP基于php模块实现个人博客搭建的图文详解

HTTPS的WordPress搭建个人博客步骤

php个人博客 谈谈PHP继承的那些事,我的个人见解

以上是WordPress搭建个人博客的详细内容。更多信息请关注PHP中文网其他相关文章!

本站声明
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系admin@php.cn

热AI工具

Undresser.AI Undress

Undresser.AI Undress

人工智能驱动的应用程序,用于创建逼真的裸体照片

AI Clothes Remover

AI Clothes Remover

用于从照片中去除衣服的在线人工智能工具。

Undress AI Tool

Undress AI Tool

免费脱衣服图片

Clothoff.io

Clothoff.io

AI脱衣机

AI Hentai Generator

AI Hentai Generator

免费生成ai无尽的。

热门文章

R.E.P.O.能量晶体解释及其做什么(黄色晶体)
3 周前 By 尊渡假赌尊渡假赌尊渡假赌
R.E.P.O.最佳图形设置
3 周前 By 尊渡假赌尊渡假赌尊渡假赌
R.E.P.O.如果您听不到任何人,如何修复音频
3 周前 By 尊渡假赌尊渡假赌尊渡假赌

热工具

记事本++7.3.1

记事本++7.3.1

好用且免费的代码编辑器

SublimeText3汉化版

SublimeText3汉化版

中文版,非常好用

禅工作室 13.0.1

禅工作室 13.0.1

功能强大的PHP集成开发环境

Dreamweaver CS6

Dreamweaver CS6

视觉化网页开发工具

SublimeText3 Mac版

SublimeText3 Mac版

神级代码编辑软件(SublimeText3)

PHP 与 Flutter 的比较:移动端开发的最佳选择 PHP 与 Flutter 的比较:移动端开发的最佳选择 May 06, 2024 pm 10:45 PM

PHP和Flutter是移动端开发的流行技术。Flutter胜在跨平台能力、性能和用户界面,适合需要高性能、跨平台和自定义UI的应用程序。PHP则适用于性能较低、不跨平台的服务器端应用程序。

wordpress如何修改页面宽度 wordpress如何修改页面宽度 Apr 16, 2024 am 01:03 AM

通过编辑 style.css 文件,您可以轻松修改 WordPress 页面宽度:编辑 style.css 文件,添加 .site-content { max-width: [您的首选宽度]; }。修改 [您的首选宽度] 以设置页面宽度。保存更改并清除缓存(可选)。

wordpress如何做产品页 wordpress如何做产品页 Apr 16, 2024 am 12:39 AM

在 WordPress 中创建产品页面:1. 创建产品(名称、描述、图片);2. 自定义页面模板(添加标题、描述、图片、按钮);3. 输入产品信息(库存、尺寸、重量);4. 创建变体(不同颜色、尺寸);5. 设置可见性(公开或隐藏);6. 启用/禁用评论;7. 预览并发布页面。

wordpress文章在哪个文件夹 wordpress文章在哪个文件夹 Apr 16, 2024 am 10:29 AM

WordPress 文章存储在 /wp-content/uploads 文件夹中。该文件夹使用子文件夹对不同类型的上传进行分类,包括按年、月和文章 ID 组织的文章。文章文件以纯文本格式 (.txt) 存储,文件名通常包含其 ID 和标题。

wordpress模板文件在哪 wordpress模板文件在哪 Apr 16, 2024 am 11:00 AM

WordPress 模板文件位于 /wp-content/themes/[主题名称]/ 目录。它们用于决定网站的外观和功能,包括页眉(header.php)、页脚(footer.php)、主模板(index.php)、单个文章(single.php)、页面(page.php)、存档(archive.php)、类别(category.php)、标签(tag.php)、搜索(search.php)和 404 错误页面(404.php)。通过编辑和修改这些文件,可以自定义 WordPress 网站的外

wordpress如何搜索作者 wordpress如何搜索作者 Apr 16, 2024 am 01:18 AM

在 WordPress 中搜索作者:1. 登录管理面板后,导航到“文章”或“页面”,使用搜索栏输入作者姓名,在“过滤器”中选择“作者”。2. 其他技巧:使用通配符扩大搜索范围,使用运算符组合条件,或输入作者 ID 以搜索文章。

wordpress哪个版本稳定 wordpress哪个版本稳定 Apr 16, 2024 am 10:54 AM

最稳定的 WordPress 版本是最新版本,因为它包含最新的安全补丁、增强性能并引入新特性和改进。为了更新到最新版本,请登录 WordPress 仪表盘,转到“更新”页面并单击“立即更新”。

wordpress用什么语言开发 wordpress用什么语言开发 Apr 16, 2024 am 12:03 AM

WordPress 采用 PHP 语言开发,作为其核心编程语言,用于处理数据库交互、表单处理、动态内容生成和用户请求。PHP 被选择的原因包括跨平台兼容性、易于学习、活跃社区以及丰富的库和框架。除了 PHP,WordPress 还使用 HTML、CSS、JavaScript、SQL 等语言来增强其功能。

See all articles