Table of Contents
1 LNMP combination
1.1 Verify the connectivity from Nginx to php
1.2 Verify php Connectivity to mysql
2 LNMP wordpress personal blog construction
2.1 Create wordpress database
2.2 Modify the blog.conf configuration file
2.3 Download the wordpress software package
2.4 Install wordpress on the web page
Home Backend Development PHP Tutorial Build a personal blog with WordPress

Build a personal blog with WordPress

Mar 22, 2018 pm 02:05 PM
wordpress blog build

This article mainly shares with you how to build a personal blog using WordPress. It mainly shares it with you in the form of pictures, text and code. I hope it can help you.

1 LNMP combination

1.1 Verify the connectivity from Nginx to php

All environments have been configured in the previous blog posts, let’s test Nginx and Connectivity between php

LNMP Nginx service construction and three types of virtual hosts
LNMP binary installation mysql-5.5.54
LNMP source code compilation and installation 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/目录中写一个Build a personal blog with WordPress文件,测试连通性[root@web01 extra]# cd /application/nginx/html/blog/[root@web01 blog]# echo "<?php Build a personal blog with WordPress(); ?>" >test_info.php[root@web01 blog]# cat test_info.php<?php Build a personal blog with WordPress(); ?>
Copy after login
Copy after login

# Do the access test in windows browser. If the following page appears, the test is successful
Build a personal blog with WordPress

1.2 Verify php Connectivity to 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();
    }?>
Copy after login
Copy after login

# Browser side test
Build a personal blog with WordPress

2 LNMP wordpress personal blog construction

2.1 Create wordpress database

# 先登录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)
Copy after login
Copy after login

2.2 Modify the blog.conf configuration file

# 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
Copy after login
Copy after login

2.3 Download the wordpress software package

# First go to the official website to check the version of the supported plug-in
Build a personal blog with 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/
Copy after login
Copy after login

2.4 Install wordpress on the web page

# The client hosts file needs to be parsed

Build a personal blog with WordPress

Build a personal blog with WordPress

Build a personal blog with WordPress

Build a personal blog with WordPress

Build a personal blog with WordPress

Build a personal blog with WordPress

Build a personal blog with WordPress

Build a personal blog with WordPress

#————————————————END!

Table of Contents



  • 1 LNMP combination

    • 1.1 Verify Nginx to PHP connectivity Property

    • 1.2 Verify the connectivity from php to mysql

  • 2 LNMP WordPress personal blog construction

    • 2.1 Create wordpress database

    • 2.2 Modify blog.conf configuration file

    • 2.3 Download wordpress software package

    • 2.4 Web page installation wordpress

1 LNMP combination

1.1 Verify the connectivity from Nginx to php

All the environments have been configured in the previous blog posts. Let’s test the connection between Nginx and php

LNMP Nginx service establishment and three types of virtualization Host

LNMP binary installation mysql-5.5.54
LNMP source code compilation and installation 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/目录中写一个Build a personal blog with WordPress文件,测试连通性[root@web01 extra]# cd /application/nginx/html/blog/[root@web01 blog]# echo "<?php Build a personal blog with WordPress(); ?>" >test_info.php[root@web01 blog]# cat test_info.php<?php Build a personal blog with WordPress(); ?>
Copy after login
Copy after login

# Do access test in windows browser, if it appears The following page tested successfully
Build a personal blog with WordPress

1.2 Verify the connectivity from php to 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();
    }?>
Copy after login
Copy after login

# Browser-side test
Build a personal blog with WordPress

2 LNMP WordPress personal blog construction

2.1 Create wordpress database

# 先登录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)
Copy after login
Copy after login

2.2 Modify blog.conf configuration file

# 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
Copy after login
Copy after login

2.3 Download wordpress software Package

# First go to the official website to check the version of the supported plug-ins
Build a personal blog with 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/
Copy after login
Copy after login
2.4 Install wordpress on the webpage

# The client hosts file needs to be parsed

Build a personal blog with WordPress

Build a personal blog with WordPress

Build a personal blog with WordPress

Build a personal blog with WordPress

Build a personal blog with WordPress

Build a personal blog with WordPress

Build a personal blog with WordPress

Build a personal blog with WordPress

related suggestion :

LAMP Detailed graphic and text explanation of building a personal blog based on the php module

Steps to build a personal blog using WordPress using HTTPS

php personal blog Talk about those things inherited by PHP, my personal opinion

The above is the detailed content of Build a personal blog with WordPress. For more information, please follow other related articles on the PHP Chinese website!

Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

Video Face Swap

Video Face Swap

Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Tools

Notepad++7.3.1

Notepad++7.3.1

Easy-to-use and free code editor

SublimeText3 Chinese version

SublimeText3 Chinese version

Chinese version, very easy to use

Zend Studio 13.0.1

Zend Studio 13.0.1

Powerful PHP integrated development environment

Dreamweaver CS6

Dreamweaver CS6

Visual web development tools

SublimeText3 Mac version

SublimeText3 Mac version

God-level code editing software (SublimeText3)

PHP vs. Flutter: The best choice for mobile development PHP vs. Flutter: The best choice for mobile development May 06, 2024 pm 10:45 PM

PHP and Flutter are popular technologies for mobile development. Flutter excels in cross-platform capabilities, performance and user interface, and is suitable for applications that require high performance, cross-platform and customized UI. PHP is suitable for server-side applications with lower performance and not cross-platform.

How to change page width in wordpress How to change page width in wordpress Apr 16, 2024 am 01:03 AM

You can easily modify your WordPress page width by editing your style.css file: Edit your style.css file and add .site-content { max-width: [your preferred width]; }. Edit [your preferred width] to set the page width. Save changes and clear cache (optional).

In which folder are wordpress articles located? In which folder are wordpress articles located? Apr 16, 2024 am 10:29 AM

WordPress posts are stored in the /wp-content/uploads folder. This folder uses subfolders to categorize different types of uploads, including articles organized by year, month, and article ID. Article files are stored in plain text format (.txt), and the filename usually includes its ID and title.

Where is the wordpress template file? Where is the wordpress template file? Apr 16, 2024 am 11:00 AM

WordPress template files are located in the /wp-content/themes/[theme name]/ directory. They are used to determine the appearance and functionality of the website, including header (header.php), footer (footer.php), main template (index.php), single article (single.php), page (page.php), Archive (archive.php), category (category.php), tag (tag.php), search (search.php) and 404 error page (404.php). By editing and modifying these files, you can customize the appearance of your WordPress website

How to search for authors in WordPress How to search for authors in WordPress Apr 16, 2024 am 01:18 AM

Search for authors in WordPress: 1. Once logged in to your admin panel, navigate to Posts or Pages, enter the author name using the search bar, and select Author in Filters. 2. Other tips: Use wildcards to broaden your search, use operators to combine criteria, or enter author IDs to search for articles.

Which version of wordpress is stable? Which version of wordpress is stable? Apr 16, 2024 am 10:54 AM

The most stable WordPress version is the latest version because it contains the latest security patches, performance enhancements, and introduces new features and improvements. In order to update to the latest version, log into your WordPress dashboard, go to the Updates page and click Update Now.

Does wordpress need to be registered? Does wordpress need to be registered? Apr 16, 2024 pm 12:07 PM

WordPress requires registration. According to my country's "Internet Security Management Measures", websites that provide Internet information services within the country must register with the local provincial Internet Information Office, including WordPress. The registration process includes steps such as selecting a service provider, preparing information, submitting an application, reviewing and publishing, and obtaining a registration number. The benefits of filing include legal compliance, improving credibility, meeting access requirements, ensuring normal access, etc. The filing information must be true and valid, and must be updated regularly after filing.

What is the wordpress article database? What is the wordpress article database? Apr 16, 2024 am 11:12 AM

WordPress uses MySQL as its article database, its main functions include: storing articles, comments, users and website configuration data. The data tables include: wp_posts (articles), wp_postmeta (metadata), wp_comments (comments), wp_commentmeta (comment metadata), wp_users (users). The database can be accessed and managed via phpMyAdmin or the command line, and it is crucial to back up the database regularly to prevent data loss.

See all articles