I built it on a virtual machine.

1. Install the database

// Download the yum installation package from the official website

wget http://dev.mysql.com/get/mysql57-community-release-el7-11.noarch.rpm

// Then install mysql source

yum localinstall mysql57-community-release-el7-11.noarch.rpm

// Check whether the source is successfully installed

yum repolist enabled |grep "mysql.*-community.*"

2. Configure the database

/ / mysql installation

yum install mysql-community-server

/ / start mysql

systemctl start mysqld

// Check the mysql running status

systemctl status mysqld

// Boot

systemctl enable mysqld

systemctl daemon-reload

// After mysql is installed, a default password is generated for root user in /var/log/mysqld.log

grep 'password' /var/log/mysqld.log

// Then enter mysql to change the password

mysql -uroot -p

ALTER USER 'root'@'localhost' IDENTIFIED BY 'new password ';

// The default password policy must contain uppercase and lowercase letters, digits, and special characters and be larger than 8 characters!

// View the password policy

show variables like '%password%';

To modify the password policy, add validate_password_policy=0 (0 indicates LOW, 1 indicates MEDIUM, and 2 indicates STRONG) to the /etc/my. CNF file, or disable the password policy. Validate_password =off Takes effect after restart. systemctl restart mysqld

3, MySQL remote login authorization and alter database character set

Log file /var/log/mysqld.log file /etc/my.cnf // Add remote login user // The default root account can only be used for login to localhost. Add a new account for remote login

grant all privileges on *.* to 'new_user'@'%' identified by 'new_pwd' with grant option;

// set the default encoding to utf8, modify /etc/my.cnf, add to [mysqld] :

      [mysqld]
      character_set_server=utf8
      init_connect='SET NAMES utf8
Copy the code

// Check the current encoding of mysql

show variables like 'character%';

4. Install PHP

rpm -Uvh https://dl.Fedoraproject.org/pub/epel/7/x86_64/Packages/e/epel-release-7-11.noarch.rpm

rpm -Uvh https://mirror.webtatic.com/yum/el7/webtatic-release.rpm

4.1. Clear historical versions

In order to prevent PHP collisions on CentOS, it is better to execute this command first.

yum -y remove php*

4.3. Install the extension package

yum -y install php72w php72w-cli php72w-fpm php72w-common php72w-devel php72w-embedded php72w-gd php72w-mbstring php72w-mysqlnd php72w-opcache php72w-pdo php72w-xml

4.4 After the installation, start the service

systemctl enable php-fpm.service

systemctl start php-fpm.service

The installation is complete

5. Install nginx

Juejin. Im/editor/post…

6. Download wordpress and upload the file to the root directory

Cn.wordpress.org/wordpress-4…

6.1. Decompress the package to the SRV directory

Tar -zxvf /root/wordpress-4.9.4-zh_cn.zip -c/SRV

6.2. Create database wordpress

create database wordpress

6.3. Create a user

create user 'me'@'localhost' identified by 'Hxs? 1234 ';

MySQL5.7 requires a password of at least 8 letters + characters + numbers

6.4. Grant all permissions to the new user. Without this command, the wordpress installer will not start:

     GRANT ALL PRIVILEGES ON wordpress.* TO 'me'@'localhost' IDENTIFIED BY 'Hxs? 1234 '; 
     FLUSH PRIVILEGES;
Copy the code

6.5 Switch to SRV, grant ownership of the wordpress directory to nginx, and change the read/write permission to 777

     chown -R nginx:nginx wordpress
     chmod -R 777 wordpress
Copy the code

6.6 Open the default.conf file in the conf.d directory of the nginx and modify the configuration

vi /etc/nginx/conf.d/default.conf

#
# The default server
#
server {
    listen       80;
    server_name  _;

    #charset koi8-r;

    #access_log logs/host.access.log main;location / { root /srv/wordpress; // Change the installation location of wordpress to index index.php index.html index.htm; } error_page 404 /404.html; location = /404.html { root /usr/share/nginx/html; }# redirect server error pages to the static page /50x.html
    #
    error_page   500 502 503 504  /50x.html;
    location = /50x.html {
        root   /usr/share/nginx/html;
    }

    # proxy the PHP scripts to Apache listening on 127.0.0.1:80
    #
    #location ~ \.php$ {
    # proxy_pass http://127.0.0.1;
    #}

    # pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000
    #location ~ \.php$ { root /srv/wordpress; // Change this to the installation location of wordpress fastcgi_pass 127.0.0.1:9000; fastcgi_index index.php; fastcgi_param SCRIPT_FILENAME$document_root$fastcgi_script_name;
        include        fastcgi_params;
    }

    # deny access to .htaccess files, if Apache's document root
    # concurs with nginx's one
    #
    #location ~ /\.ht {
    # deny all;
    #}
}
Copy the code

6.7. Restart the Nginx server

service nginx reload

6.8. View the VM IP address, open the ADDRESS in the browser of the local PC, and install wordpress

ip addr