LNMP+WordPress (build your own personal blog website)

Introduction to LNMP composition

LNMP (Linux-Nginx-MySQL-PHP) website architecture is currently an internationally popular Web framework. The framework includes: Linux operating system, Nginx web server, MySQL database, and PHP programming language. All component products are free and open source software. These four All kinds of software are combined together to become a free and efficient website service system.

How LNMP works

The browser sends an http request to the server (Nginx), and the server responds and processes the web request. If it is static text, it is returned directly. Otherwise, the script (PHP) is transmitted to PHP-FPM (process manager) through the interface transmission protocol (gateway protocol) PHP-FCGI (fast-cgi), and then PHP-FPM calls the PHP parser. A process PHP-CGI to parse php script information. [PHP-FPM starts multiple PHP-CGI sub-processes at startup and executes them concurrently. 】Then the parsed script is returned to PHP-FPM, and PHP-FPM transmits the script information to Nginx in the form of fast-cgi. The server then sends it to the browser in the form of Http response. The browser then parses and renders it and then renders it.

Introduction to WordPress

Introduction to WordPress WordPress is a blogging platform developed using the PHP language. Users can set up their own websites on servers that support PHP and MySQL databases. You can also use WordPress as a content management system (CMS). WordPress is a free, open source project licensed under the GNU General Public License.

1. Install LNMP

Preparation work: Set up DNS for the virtual machine network card (make sure it is connected to the external network)

 vi /etc/sysconfig/network-scripts/ifcfg-eno16777736
DNS=114.114.114.114

 

 

Upload the LNMP compressed package to the /opt directory and decompress it

cd /opt
tar -zxvf lnmp1.7.tar.gz #解压

 Enter the directory after LNMP decompression

cd lnmp1.7

 Execute this script to install the package

./install lnmp1.7 

Select MySQL version

 Next, set the password for the MySQL database

 Ask whether you need to enable MySQL InnoDB. The InnoDB engine is enabled by default. It is generally recommended to enable it. Just press Enter or enter y. If you are sure that you do not need the engine, you can enter n. (MySQL 5.7+ version cannot close InnoDB). After the input is completed, press Enter. Go to next step

 Next step, select the PHP version.
Note: When choosing the PHP 7+ version, you need to confirm whether the PHP version is compatible with your program.

For the next step of memory optimization, I usually choose to just press Enter to skip it. You can choose according to your needs

 Finally, just wait for the installation (the installation speed depends on the configuration of the virtual machine, I installed it for 40 minutes)

After the installation is complete, it will appear

 Check out MySQL. PHP. Nginx ports are all open

Then LNMP is installed successfully.

After the installation is complete, set up the database

Login to MySQL

mysql -uroot -p

 Enter the password to enter

 Create wordpress database and set remote access permissions

create database wordpress; #创建wordpress数据库
grant all privileges on wordpress.to 'wordpress'@'localhost'; #授予远程访问等权限

2. WordPress installation

Upload the compressed package to /opt and decompress it

cd /opt
tar -zxvf wordpress-5.0.2-zh_CN.tar.gz

After decompression is complete, delete the nginx default HTML page file

cd /home/wwwroot/default
rm -rf index.html

 Go back to the /opt/wordpress directory, copy all the files in this directory to the /home/wwwroot/default directory, and grant 777 permissions

cp -rvf * /home/wwwroot/default、
chmod 777 *

In the directory /home/wwwroot/default, you can see a configuration file wp-config-sample.php. This file is a template configuration file provided by the WordPress application. Copy the template and rename it wp-config. .php and edit the file.

cp wp-config-sample.php wp-config.php
vi wp-config.php

 

 After modification, save and exit.

Enter the IP address in the browser and the following image will appear

 Enter the necessary information and click Install.

After installation, the personal blog is completed.

 

 

Guess you like

Origin blog.csdn.net/m0_74090215/article/details/130874094