CentOS 7.4 yum to build LNMP environment, deploy WordPress blog, and install XCache module

1. Demonstration environment:

IP

installed package

Version

192.168.1.221

nginx epel _

1.12.2

php

5.4.16

php-fpm ( FastCGI Process Manager)

php-mysql ( The driver required for PHP to connect to MySQL )

192.168.1.222

mariadb-server

5.5.56

   Note: CentOS 7.4 no longer has built-in mysql-server package

2. Build LNMP :

1. Preparation before installation:

   (1) Proofreading server time

   (2)  Configure the epel source

2、安装nginx# yum -y install nginx  # systemctl start nginx.service  # ss -tunlp | grep :80

   Configuration files and directories:

Ø   Main configuration file: /etc/nginx/nginx.conf

Ø   Auxiliary configuration file: /etc/nginx/*

ØWeb   page storage root directory: /usr/share/nginx/html

3. Install php : # yum -y install php , configuration file: /etc/php.ini

4. Install and configure php-fpm :

      # yum -y install php-fpm

      # vim /etc/php-fpm.d/www.conf , modify the values ​​of the following parameters:

      listen = 192.168.1.221:9000 // The address port that php-fpm listens to

      listen.allowed_clients = 192.168.1.221 // The FastCGI client address that is allowed to connect

      user = nginx

      group = nginx

      # systemctl start php-fpm.service

      # ss -tunlp | grip: 9000

   Configuration file:

Ø   Main configuration file: /etc/php-fpm.conf

Ø   Auxiliary configuration file: /etc/php-fpm.d/www.conf

5. Install and configure mariadb :

      # yum -y install mariadb-server mariadb mariadb-devel

      # systemctl start mariadb.service

      # ss -tunlp | grip: 3306

      mariadb configuration file: /etc/my.cnf

      // Modify the root user password of the mariadb database to 123456 (default is empty), delete anonymous users, delete the test database, and reload the authorization table

      # mysql_secure_installation

      # mysql -uroot -p

1.jpg


      MariaDB [(none)]> grant all on *.* to 'root'@'192.168.%.%' identified by '123456'; // Authorize root user to log in remotely

      MariaDB [(none)]> flush privileges;

6. Install php-mysql : # yum -y install php-mysql

7.  Configure nginx to support php :

      # cd /etc/nginx

      # cp nginx.conf nginx.conf.bak

      # vim nginx.conf

2.jpg


       # systemctl reload nginx.service

       # systemctl restart php-fpm.service

3. Test LNMP :

       # cd /usr/share/nginx/html

       # vim index.php

      3.jpg

   

Enter http://192.168.1.221/index.php    in the browser :

4.jpg


   Stop mariadb on 192.168.1.222 : # systemctl stop mariadb.service

5.jpg


       The communication between mariadb and php is normal

   Visit http://192.168.1.221

6.jpg



Fourth, install and configure WordPress :

WordPress is an open source, free Blog engine developed using PHP language and MariaDB database. Users can build their own Blog on servers that support PHP and MariaDB database . WordPress is a very powerful blogging system with numerous plugins, easy to extend, and very convenient to install and use. At present , WordPress has become the mainstream blog building platform. The download address is https://cn.wordpress.org/ , here wordpress-4.8.1-zh_CN.zip is used as an example.

       # yum -y install unzip

       # unzip -q wordpress-4.8.1-zh_CN.zip

       # cp -a wordpress/ /usr/share/nginx/html

       # cd /usr/share/nginx/html/wordpress

       # cp wp-config-sample.php wp-config.php

       # vim wp-config.php , modify the database related information:

7.jpg


       # mysql -uroot -p

      MariaDB [(none)]> create database wpdb;

      MariaDB [(none)]> grant all on wpdb.* to 'wpuser'@'%' identified by "123456";

      MariaDB [(none)]> flush privileges;

      # mysql -uwpuser -p

      MariaDB [(none)]> show databases;

8.jpg


   Modify the nginx configuration file and add index.php after the index parameter :

      # vim /etc/nginx/nginx.conf

      location / {

      index index.php index.html index.htm;

      }

      # systemctl reload nginx.service

Enter http://192.168.1.221/wordpress    in the browser :

9.jpg


   Click on "Install WordPress ":

10.jpg


   Click to Login":

11.jpg


   Enter your username and password and click "Login":

12.jpg


13.jpg


14.jpg

   Delete the installation file: # rm -rf /usr/share/nginx/html/wordpress/wp-admin/install.php

   Blog front desk login address http://192.168.1.221/wordpress/

   Blog background management address http://192.168.1.221/wordpress/wp-admin/

Fifth, install the XCache module:

   Configure epel source, install XCache : # yum -y install php-xcache --> 3.1.1

      # rpm -ql php-xcache  -->  /etc/php.d/xcache.ini/usr/lib64/php/modules/xcache.so

      # systemctl reload nginx.service

      # systemctl restart php-fpm.service

XCache related modules    loaded :

15.jpg


 

16.jpg


Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=324540365&siteId=291194637