Installing the necessary software using Yum
Yum install nginx php php-fpm php-mysql mysql-server-y
Set each software to boot
Chkconfig Nginx on
Chkconfig mysqld on
Chkconfig PHP-FPM on
Configure Nginx
Vim/etc/nginx/conf.d/default.conf
Press the letter "I" key or "Insert" key to switch to edit mode, clear all existing content, copy and paste the following into the default.conf file.
server {listen 80;root/usr/share/nginx/html;server_name localhost;
#charset koi8-r; #access_log/var/log/nginx/log/host.access.log main;
Location/{
Index index.php index.html index.htm;
}
#error_page 404/404.html;
#redirect Server error pages to the static Page/50x.html#error_page 502 503 504/50x.html;location =/50x.html {
root/usr/share/nginx/html;
}
#pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000#location ~. php$ {
Fastcgi_pass 127.0.0.1:9000;
Fastcgi_index index.php;
Fastcgi_param script_filename $document _root$fastcgi_script_name;
Include Fastcgi_params;
}
} index index.php index.html index.htm;
root/usr/share/nginx/html;
Fastcgi_pass 127.0.0.1:9000;
Fastcgi_index index.php;
Fastcgi_param script_filename $document _root$fastcgi_script_name;
Include Fastcgi_params;
Start Nginx
Service Nginx Start
Configure MySQL
Start the MySQL server
Service mysqld Start
Set the password for the root user of the MySQL server, this tutorial is set to "123456", you need to use this user name and password in the next steps
/usr/bin/mysqladmin-u root Password "123456"
Configure PHP
Start the PHP-FPM service
Service PHP-FPM Start
Open/etc/php.ini File
Vim/etc/php.ini
Enter the following directly after entering, carriage return to the location of "Session.save_path":
Session.save_path = "/var/lib/php/session"
Change the group of all files under the/var/lib/php/session directory to Nginx and Nginx
Chown-r nginx:nginx/var/lib/php/session
Use the following command to create a index.php file in the Web directory
vim/usr/share/nginx/html/index.php
Test page ";
echo "Hello world!";
?>
Delete the index.html file from the root of the Web site first
Rm/usr/share/nginx/html/index.html
Download WordPress and unzip to the current directory
wget https://cn.wordpress.org/wordpress-4.9.4-zh_CN.tar.gz
Tar zxvf wordpress-4.9.4-zh_cn.tar.gz
Configuration database
Log on to the MySQL server with the root user
Mysql-uroot-p
Create MySQL Database "wordpress" for WordPress
CREATE DATABASE WordPress;
Create a new user for the created MySQL database "[email protected]
CREATE USER [email protected];
and set the password "Wordpresspassword" for this user
SET PASSWORD for [email Protected]=password ("Wordpresspassword");
Full access to the database "WordPress" is opened for the created user.
GRANT all privileges the wordpress.* to [e-mail protected] identified by ' Wordpresspassword ';
Use the following command to make all configurations effective
FLUSH privileges;
Configuration complete, Exit MySQL
Exit
Write Database Information
Create a new configuration file
CD wordpress/
CP wp-config-sample.php wp-config.php
Open and edit the newly created configuration file
Vim wp-config.php
MySQL settings–you can get this info from your web host //
/* The name of the database for WordPress /
Define (' db_name ', ' WordPress ');
/* MySQL database username /
Define (' Db_user ', ' USER ');
/* MySQL Database Password /
Define (' Db_password ', ' Wordpresspassword ');
/* MySQL hostname /
Define (' db_host ', ' localhost ');
Install WordPress
MV */usr/share/nginx/html/
Enter the IP address of the WordPress site in the Web browser address bar
CentOS Build WordPress personal Site