This article mainly and everyone to share WordPress build a personal blog, mainly in the form of text and code and share with you, hope to help everyone.
1 LNMP Combination
1.1 Verifying the connectivity of Nginx to PHP
In the previous few posts, all the environments have been configured, and the following tests the connectivity between Nginx and PHP
LNMP's Nginx service building and three types of virtual hosting
LNMP Binary Installation mysql-5.5.54
LNMP Source Compilation Installation php-5.5.32
# modify/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; }}# restart Nginx service [root@web01 extra]#. /.. /sbin/nginx-tnginx: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 extra]#. /.. /sbin/nginx-s reload# Write a phpinfo file in the/application/nginx/html/blog/directory, test connectivity [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 ();?;
# Access Test in Windows Explorer, test successful if the following page appears
1.2 Verifying the connectivity of PHP to MySQL
# Write a simple database connection script [Root@web01 blog]# cat test_mysql.php<?php $link _id=mysql_connect (' localhost ', ' root ', ' Oldboy123 ') or mysql_error (); if ($link _id) { echo "Mysql successful by RSQ!"; } else{ Echo mysql_error (); }? >
# Browser-side testing
2 lnmp wordpress Personal Blog Building
2.1 Creating a WordPress Database
# Log in to MySQL first, create the database needed for 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; # Delete Redundant test database 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; # Create WordPress user 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) # Create a specially managed wordpress user for the WordPress database and grant all permissions mysql> grant all on WOR dpress.* to wordpress@ ' localhost ' identified by ' 123456 '; Query OK, 0 rows Affected (0.00 sec) mysql> Select User,host from Mysql.user; # See if WordPress database user created +-----------+-----------+| 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@ ' localhost '; # View the permissions that the specified user has mysql> flush privileges; # Refresh, make user rights effective query OK, 0 rows Affected (0.00 sec)
2.2 Modifying the blog.conf configuration file
# blog.conf config file in index new INDEX.HTML[ROOT@WEB01 extra]# cat blog.conf server { listen ; 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 Download WordPress Package
# Go to the official website to see the version of the supported plugins
# go to the official website to download the latest WordPress package [root@web01 extra]# cd/home/oldboy/tools/[root@web01 tools]# wget https://cn.wordpress.org/ wordpress-4.9.4-zh_cn.tar.gz# extract [root@web01 tools]# tar-xf wordpress-4.9.4-zh_cn.tar.gz# Copy all contents of WordPress directory to/ application/nginx/html/blog/directory [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# grant permission, first temporarily grant all files, and then adjust the permissions later [Root@web01 tools]# chown-r www.www/application/nginx/html/blog/
2.4 Web page Install WordPress
# Client Hosts file to be parsed
——————————————— end!
Directory
1 LNMP Combination
1.1 Verifying the connectivity of Nginx to PHP
In the previous few posts, all the environments have been configured, and the following tests the connectivity between Nginx and PHP
Lnmp and three types of virtual hosts
Lnmp binary installation mysql-5.5.54
LNMP source code compilation installation php-5.5.32
# modify/APPLICATION/NGINX/CONF/EXTRA/BLOG.CONF[ROOT@WEB01 extra]# cat blog.conf server {L Isten 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; }}# restart Nginx service [root@web01 extra]#. /.. /sbin/nginx-tnginx: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 extra]#. /.. /sbin/nginx-s reload# Write a phpinfo file in the/application/nginx/html/blog/directory, test connectivity [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 ();?;
# Access Test in Windows Explorer, test successful if the following page appears
1.2 Verifying the connectivity of PHP to MySQL
# Write a simple database connection script [Root@web01 blog]# cat test_mysql.php<?php $link _id=mysql_connect (' localhost ', ' root ', ' Oldboy123 ') or mysql_error (); if ($link _id) { echo "Mysql successful by RSQ!"; } else{ Echo mysql_error (); }? >
# Browser-side testing
2 lnmp wordpress Personal Blog Building
2.1 Creating a WordPress Database
# Log in to MySQL first, create the database needed for 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; # Delete Redundant test database 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; # Create WordPress user 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) # Create a specially managed wordpress user for the WordPress database and grant all permissions mysql> grant all on WOR dpress.* to wordpress@ ' localhost ' identified by ' 123456 '; Query OK, 0 rows Affected (0.00 sec) mysql> Select User,host from Mysql.user; # See if WordPress database user created +-----------+-----------+| 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@ ' localhost '; # View the permissions that the specified user has mysql> flush privileges; # Refresh, make user rights effective query OK, 0 rows Affected (0.00 sec)
2.2 Modifying the blog.conf configuration file
# blog.conf config file in index new INDEX.HTML[ROOT@WEB01 extra]# cat blog.conf server { listen ; 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 Download WordPress Package
# Go to the official website to see the version of the supported plugins
# go to the official website to download the latest WordPress package [root@web01 extra]# cd/home/oldboy/tools/[root@web01 tools]# wget https://cn.wordpress.org/ wordpress-4.9.4-zh_cn.tar.gz# extract [root@web01 tools]# tar-xf wordpress-4.9.4-zh_cn.tar.gz# Copy all contents of WordPress directory to/ application/nginx/html/blog/directory [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# grant permission, first temporarily grant all files, and then adjust the permissions later [Root@web01 tools]# chown-r www.www/application/nginx/html/blog/
2.4 Web page Install WordPress
# Client Hosts file to be parsed