Enterprise Actual LNMP High Performance Server_wordpress, discuz dual site deployment

Keywords: Linux PHP Nginx MySQL zlib

Enterprise Actual LNMP High Performance Server_wordpress, discuz dual site deployment

In LNMP WEB architecture, Nginx is a high performance WEB server and cannot process PHP itself. When receiving HTTP Request requests from client browsers, Nginx server responds to and processes WEB requests. Static resource CSS, pictures, videos, TXT and other static file requests are processed and responded to directly by Nginx server.

However, PHP dynamic page requests cannot be handled directly by Nginx. The Nginx server transfers PHP web page scripts to PHP-FPM (Process Manager) through the Interface Transfer Protocol (Gateway Protocol) PHP-FCGI (Fast-CGI), which is not handled by PHP-FPM. PHP-FPM then calls the PHP parser process, and the PHP parser parses the PHP script information.The PHP parser process can start multiple processes, allowing multiple processes to execute concurrently.

The PHP interpreter returns the parsed script to PHP-FPM. PHP-FPM then transmits the script information to Nginx in the form of Fast-CGI. The Nginx server then transmits the script information to the browser in the form of Http Response. The browser then parses and renders the script and renders it.

1. Source installation MySQL 5.7.30

1.1 Preparing for source compilation and installation

1.1.1 Because the CentOS system comes with mariadb, we need to uninstall it first.
[root@node01 ~]# rpm -qa|grep mariadb
mariadb-server-5.5.60-1.el7_5.x86_64
mariadb-libs-5.5.60-1.el7_5.x86_64
mariadb-5.5.60-1.el7_5.x86_64
[root@node01 ~]# 
[root@node01 ~]# yum -y remove mariadb mariadb-server mariadb-libs
1.1.2 Create User
[root@node01 ~]# useradd -s /sbin/nologin -M mysql      #Hint that mysql already exists to ignore this step
1.1.3 Create directories and modify permissions
[root@node01 ~]# mkdir -p /data/mysql
[root@node01 ~]# chown -R mysql.mysql /data
1.1.4 Install MySQL-related dependency packages
[root@node01 ~]# yum install -y gcc gcc-devel gcc-c++ gcc-c++-devel libaio* autoconf* automake* zlib* libxml* ncurses-devel ncurses libgcrypt* libtool* cmake openssl openssl-devel bison bison-devel perl-Data_Dumper boost boost-doc boost-devel
1.1.5 Download the source code and unzip it
[root@node01 ~]# cd /usr/src/
[root@node01 src]# wget http://mirrors.163.com/mysql/Downloads/MySQL-5.7/mysql-5.7.30.tar.gz
[root@node01 src]# ls
debug  kernels  mysql-5.7.30.tar.gz
[root@node01 src]# tar xf mysql-5.7.30.tar.gz
[root@node01 src]# cd mysql-5.7.30/
[root@node01 mysql-5.7.30]# 
1.1.6 Download boost (there have been many changes since the 5.7 update, such as installing this boost library now is necessary)
[root@node01 mysql-5.7.30]# mkdir ./boost
[root@node01 mysql-5.7.30]# cd ./boost
[root@node01 boost]# wget http://nchc.dl.sourceforge.net/project/boost/boost/1.59.0/boost_1_59_0.tar.gz

Note: The program will do decompression and other operations when compiling, just download or copy the package here

1.2 Source Compilation Installation

1.2.1 Compilation
[root@node01 boost]# cd ../
[root@node01 mysql-5.7.30]# cmake \
-DBUILD_CONFIG=mysql_release \
-DCMAKE_BUILD_TYPE=RelWithDebInfo \
-DCMAKE_INSTALL_PREFIX=/usr/local/mysql \
-DMYSQL_DATADIR=/data/mysql \
-DSYSCONFDIR=/etc \
-DMYSQL_UNIX_ADDR=/tmp/mysql.sock \
-DSYSTEMD_PID_DIR=/data/mysql \
-DMYSQL_USER=mysql \
-DWITH_SYSTEMD=1 \
-DWITH_MYISAM_STORAGE_ENGINE=1 \
-DWITH_INNOBASE_STORAGE_ENGINE=1 \
-DWITH_ARCHIVE_STORAGE_ENGINE=1 \
-DWITH_MEMORY_STORAGE_ENGINE=1 \
-DWITH_READLINE=1 \
-DMYSQL_TCP_PORT=3306 \
-DENABLED_LOCAL_INFILE=1 \
-DENABLE_DOWNLOADS=1 \
-DWITH_PARTITION_STORAGE_ENGINE=1 \
-DEXTRA_CHARSETS=all \
-DDEFAULT_CHARSET=utf8 \
-DDEFAULT_COLLATION=utf8_general_ci \
-DWITH_DEBUG=0 \
-DMYSQL_MAINTAINER_MODE=0 \
-DWITH_SSL:STRING=system \
-DWITH_ZLIB:STRING=bundled \
-DDOWNLOAD_BOOST=1 \
-DWITH_BOOST=./boost
Introduction to 1.2.2 Compilation Parameters
cmake \
-DBUILD_CONFIG=mysql_release \                  #This option configures the source distribution using the same build options Oracle uses to generate the official MySQL version of the binary distribution.
-DCMAKE_BUILD_TYPE=RelWithDebInfo \             #Build type to generate = Enable optimization and generate debug information.This is the default MySQL build type.
-DCMAKE_INSTALL_PREFIX=/usr/local/mysql \       #Options represent the basic installation directory.
-DMYSQL_DATADIR=/data/mysql \                   #The location of the MySQL data directory.
-DSYSCONFDIR=/etc \                             #defaultMy.cnfOptions file directory.
-DMYSQL_UNIX_ADDR=/tmp/mysql.sock \             #The server listens for Unix socket file paths for socket connections.This must be an absolute path name.Default is/tmp/mysql.sock.
-DSYSTEMD_PID_DIR=/usr/local/mysql \            #The name of the directory in which the PID file is created when MySQL is managed by systemd.The default is/var/run/mysqld; this may be based on INSTALL_The LAYOUT value is implicitly changed.
-DMYSQL_USER=mysql \                            #Specify the startup user for MySQL
-DWITH_SYSTEMD=1 \                              #Install systemd support files
-DWITH_MYISAM_STORAGE_ENGINE=1 \
-DWITH_INNOBASE_STORAGE_ENGINE=1 \
-DWITH_ARCHIVE_STORAGE_ENGINE=1 \
-DWITH_MEMORY_STORAGE_ENGINE=1 \
-DWITH_READLINE=1 \
-DMYSQL_TCP_PORT=3306 \                          #Configure port number for MySQL listening
-DENABLED_LOCAL_INFILE=1 \                       #Make the mysql client load data infile, which has the security hazard of loading data infile statements into a table at a high speed from a text file                
-DENABLE_DOWNLOADS=1 \                           #The path to the googlemock release for unit testing based on Google Test.=1, CMake will download the release from GitHub.
-DWITH_PARTITION_STORAGE_ENGINE=1 \ 
-DEXTRA_CHARSETS=all \
-DDEFAULT_CHARSET=utf8 \                         #Server Character Set
-DDEFAULT_COLLATION=utf8_general_ci \            #Server Collation
-DWITH_DEBUG=0 \                                 #Debugging support is not included.
-DMYSQL_MAINTAINER_MODE=0 \                      #Whether the MySQL maintainer-specific development environment is enabled.If enabled, this option causes compiler warnings to become errors.
-DWITH_SSL:STRING=system \
-DWITH_ZLIB:STRING=bundled \
-DDOWNLOAD_BOOST=1 \                             #Whether to download the Boost library.The default is OFF.
-DWITH_BOOST=./boost                             #Specify the Boost Library Directory location.
1.2.3 Check compilation for exceptions
[root@node01 mysql-5.7.30]# echo $?              #Returning a result of 0 means no exceptions were compiled
1.2.4 Source Installation
[root@node01 mysql-5.7.30]# make && make install

It's a long process, wait patiently

1.2.5 Check installation for exceptions
[root@node01 mysql-5.7.30]# echo $?              #Returning a result of 0 means no exceptions were compiled

1.3 Source Post Installation Configuration

1.3.1 Add systemd service control
[root@node01 mysql-5.7.30]# cp ./scripts/mysqld.service /usr/lib/systemd/system
1.3.2 Add environment variables
[root@node01 mysql-5.7.30]# cat > /etc/profile.d/mysql.sh << EOF 
PATH=/usr/local/mysql/bin:$PATH
export PATH
EOF
[root@node01 mysql-5.7.30]# source /etc/profile
1.3.3 Empty Password Initialization Database
[root@node01 mysql-5.7.30]# /usr/local/mysql/bin/mysqld --initialize-insecure --user=mysql --basedir=/usr/local/mysql --datadir=/data/mysql
1.3.4 Configuration Start MySQL
[root@node01 mysql-5.7.30]# systemctl enable mysqld.service
[root@node01 mysql-5.7.30]# systemctl daemon-reload
[root@node01 mysql-5.7.30]# systemctl start mysqld.service
[root@node01 mysql-5.7.30]# systemctl status mysqld.service

2. Source installation nginx1.19.0

2.1 Installation Dependency Package

[root@node01 src]# yum install -y gcc gcc-c++ pcre pcre-devel zlib zlib-devel openssl openssl-devel

Dependent package description:

  1. Compilation depends on the GCC environment, so it requires: gcc gcc-c++;

  2. PCR E (perl Compatible Regular Expressions) is a perl library that includes perl-compatible regular expression libraries.The http module of nginx uses PCRE to parse regular expressions, so you need to install the PCRE library on linux. pcre-devel is a secondary development library developed with pcre, so you need: pcre pcre-devel;
  3. The zlib library provides a variety of compression and decompression methods. nginx uses zlib to gzip the contents of http packages, so you need to install the zlib library on Centos, so you need: zlib zlib-devel;
  4. OpenSSL is a powerful Secure Sockets Layer cryptographic library that includes key cryptographic algorithms, commonly used key and certificate encapsulation management functions, and ssl protocols, and provides rich applications for testing or other purposes.nginx supports not only the http protocol but also https (that is, http is transmitted over the ssl protocol), so you need to install the OpenSSL Library in Centos, so you need: openssl openssl-devel;

2.2 Download installation packages from the official website

[root@node01 src]# wget http://nginx.org/download/nginx-1.19.0.tar.gz

2.3 Unzip and install

[root@node01 src]# tar xf nginx-1.19.0.tar.gz 
[root@node01 src]# cd nginx-1.19.0/
[root@node01 nginx-1.19.0]# ./configure --prefix=/usr/local/nginx --with-http_stub_status_module
[root@node01 nginx-1.19.0]# echo $?
0
[root@node01 nginx-1.19.0]# 
[root@node01 nginx-1.19.0]# make && make install
[root@node01 nginx-1.19.0]# echo $?
0
[root@node01 nginx-1.19.0]# 

2.4 Add nginx environment variable

[root@node01 nginx-1.19.0]# cat > /etc/profile.d/nginx.sh << EOF 
PATH=/usr/local/nginx/sbin:$PATH
export PATH
EOF
[root@node01 nginx-1.19.0]# source /etc/profile

2.5 Test for successful installation

[root@node01 nginx-1.19.0]# nginx -V
nginx version: nginx/1.19.0
built by gcc 4.8.5 20150623 (Red Hat 4.8.5-39) (GCC) 
configure arguments: --prefix=/usr/local/nginx --with-http_stub_status_module
[root@node01 nginx-1.19.0]# 

2.6 Start nginx service

[root@node01 nginx-1.19.0]# nginx
[root@node01 nginx-1.19.0]# 

2.7 Verify that the service started successfully

[root@node01 nginx-1.19.0]# netstat -ntlp | grep 80
tcp        0      0 0.0.0.0:80              0.0.0.0:*               LISTEN      23434/nginx: master 
[root@node01 nginx-1.19.0]# 

2.8 Add nginx service

[root@node01 nginx-1.19.0]# vi /lib/systemd/system/nginx.service

Add the following:

[Unit]
Description=nginx
After=network.target

[Service]
Type=forking
ExecStart=/usr/local/nginx/sbin/nginx
ExecReload=/usr/local/nginx/sbin/nginx -s reload
ExecStop=/usr/local/nginx/sbin/nginx -s quit
PrivateTmp=true

[Install]
WantedBy=multi-user.target

2.9 Start nginx as a service

[root@node01 nginx-1.19.0]# pkill nginx
[root@node01 nginx-1.19.0]# 
[root@node01 nginx-1.19.0]# systemctl start nginx

2.10 Check if the nginx service is started

[root@node01 nginx-1.19.0]# systemctl status nginx
● nginx.service - nginx
   Loaded: loaded (/usr/lib/systemd/system/nginx.service; disabled; vendor preset: disabled)
   Active: active (running) since Thu 2020-06-11 03:56:27 CST; 6s ago
  Process: 23763 ExecStart=/usr/local/nginx/sbin/nginx (code=exited, status=0/SUCCESS)
 Main PID: 23764 (nginx)
    Tasks: 2
   CGroup: /system.slice/nginx.service
           ├─23764 nginx: master process /usr/local/nginx/sbin/nginx
           └─23765 nginx: worker process

Jun 11 03:56:27 node01 systemd[1]: Starting nginx...
Jun 11 03:56:27 node01 systemd[1]: Started nginx.
[root@node01 nginx-1.19.0]# 
[root@node01 nginx-1.19.0]# netstat -ntlp | grep nginx
tcp        0      0 0.0.0.0:80              0.0.0.0:*               LISTEN      23764/nginx: master 
[root@node01 nginx-1.19.0]# 

2.11 Configure nginx service autostart

[root@node01 nginx-1.19.0]# systemctl enable nginx
Created symlink from /etc/systemd/system/multi-user.target.wants/nginx.service to /usr/lib/systemd/system/nginx.service.
[root@node01 nginx-1.19.0]# 
[root@node01 nginx-1.19.0]# systemctl status nginx
● nginx.service - nginx
   Loaded: loaded (/usr/lib/systemd/system/nginx.service; enabled; vendor preset: disabled)
   Active: active (running) since Thu 2020-06-11 03:56:27 CST; 2min 6s ago
 Main PID: 23764 (nginx)
   CGroup: /system.slice/nginx.service
           ├─23764 nginx: master process /usr/local/nginx/sbin/nginx
           └─23765 nginx: worker process

Jun 11 03:56:27 node01 systemd[1]: Starting nginx...
Jun 11 03:56:27 node01 systemd[1]: Started nginx.
[root@node01 nginx-1.19.0]# 

2.12 Managing nginx using systemctl

[root@node01 nginx-1.19.0]# systemctl start nginx  #Start Services
[root@node01 nginx-1.19.0]# systemctl status nginx  #View Status
[root@node01 nginx-1.19.0]# systemctl stop nginx  #Out of Service
[root@node01 nginx-1.19.0]# systemctl restart nginx  #Restart Service
[root@node01 nginx-1.19.0]# systemctl reload nginx  #Overload after modifying configuration file
[root@node01 nginx-1.19.0]# systemctl enable nginx  #Start-up self-start
[root@node01 nginx-1.19.0]# systemctl didable nginx  #Prohibit startup and self-startup 

3. Source installation php5.6.40

3.1 Installation Dependency Package

[root@node01 ~]# yum -y install gd curl curl-devel libjpeg libjpeg-devel libpng libpng-devel freetype freetype-devel libxml2 libxml2-devel

3.2 Go to the official website to download security packages

[root@node01 src]# wget https://www.php.net/distributions/php-5.6.40.tar.gz

3.3 Unzip and install

[root@node01 src]# tar xf php-5.6.40.tar.gz 
[root@node01 src]# cd php-5.6.40/
[root@node01 php-5.6.40]# ./configure --prefix=/usr/local/php  \
 --enable-fpm \
 --enable-debug \
 --with-gd \
 --with-jpeg-dir \
 --with-png-dir \
 --with-freetype-dir \
 --enable-mbstring \
 --with-curl \
 --with-mysql=mysqlnd \
 --with-mysqli=mysqlnd \
 --with-pdo-mysql=mysqlnd \
 --with-config-file-path=/usr/local/php/etc \
 --with-zlib-dir
[root@node01 php-5.6.40]# 
[root@node01 php-5.6.40]# echo $?
0
[root@node01 php-5.6.40]#
[root@node01 php-5.6.40]# make && make install
[root@node01 php-5.6.40]# echo $?
0
[root@node01 php-5.6.40]#

3.4 Add php environment variables

[root@node01 php-5.6.40]# cat > /etc/profile.d/php.sh << EOF 
PATH=/usr/local/php/bin/:$PATH
export PATH
EOF
[root@node01 php-5.6.40]# source /etc/profile

3.5 Test for successful installation

[root@node01 php-5.6.40]# php -v
PHP 5.6.40 (cli) (built: Jun 11 2020 07:29:14) (DEBUG)
Copyright (c) 1997-2016 The PHP Group
Zend Engine v2.6.0, Copyright (c) 1998-2016 Zend Technologies
[root@node01 php-5.6.40]# 

3.6 Copy template files

[root@node01 php-5.6.40]# cp php.ini-development  /usr/local/php/etc/php.ini
[root@node01 php-5.6.40]# cp /usr/local/php/etc/php-fpm.conf.default /usr/local/php/etc/php-fpm.conf
[root@node01 php-5.6.40]# cp sapi/fpm/init.d.php-fpm /etc/init.d/php-fpm
[root@node01 php-5.6.40]# chmod +x /etc/init.d/php-fpm

3.7 Create nginx user and modify php-fpm to nginx user

[root@node01 php-5.6.40]# useradd -s /sbin/nologin -m nginx
[root@node01 php-5.6.40]# cp /usr/local/php/etc/php-fpm.conf{,.bak}
[root@node01 php-5.6.40]# 
[root@node01 php-5.6.40]# vi /usr/local/php/etc/php-fpm.conf
[root@node01 php-5.6.40]# 
[root@node01 php-5.6.40]# egrep "^(user|group)" /usr/local/php/etc/php-fpm.conf
user = nginx
group = nginx
[root@node01 php-5.6.40]# 

3.8 Add php-fpm service

3.8.1 Modify php-fpm.conf

Open php-fpm.conf

[root@node01 php-5.6.40]# vi /usr/local/php/etc/php-fpm.conf

Find the following and modify it:

; Pid file
; Note: the default prefix is /usr/local/php/var
; Default Value: none
pid = /var/run/php-fpm.pid
3.8.2 New php-fpm Service File
vi /usr/lib/systemd/system/php-fpm.service

Add the following:

[Unit]
Description=The PHP FastCGI Process Manager
After=syslog.target network.target

[Service]
Type=forking
PIDFile=/var/run/php-fpm.pid
ExecStart=/usr/local/php/sbin/php-fpm
ExecReload=/bin/kill -USR2 $MAINPID
PrivateTmp=true

[Install]
WantedBy=multi-user.target

3.9 Start php-fpm as a service

[root@node01 php-5.6.40]# systemctl daemon-reload
[root@node01 php-5.6.40]# systemctl start php-fpm          
[root@node01 php-5.6.40]# 

3.10 Check if php-fpm service is started

[root@node01 php-5.6.40]# systemctl status php-fpm
● php-fpm.service - The PHP FastCGI Process Manager
   Loaded: loaded (/usr/lib/systemd/system/php-fpm.service; disabled; vendor preset: disabled)
   Active: active (running) since Thu 2020-06-11 08:02:38 CST; 4min 47s ago
  Process: 21478 ExecStart=/usr/local/php/sbin/php-fpm (code=exited, status=0/SUCCESS)
 Main PID: 21481 (php-fpm)
    Tasks: 3
   CGroup: /system.slice/php-fpm.service
           ├─21481 php-fpm: master process (/usr/local/php/etc/php-fpm.conf)
           ├─21482 php-fpm: pool www
           └─21483 php-fpm: pool www

Jun 11 08:02:38 node01 systemd[1]: Starting The PHP FastCGI Process Manager...
Jun 11 08:02:38 node01 systemd[1]: Started The PHP FastCGI Process Manager.
[root@node01 php-5.6.40]# 
[root@node01 php-5.6.40]# netstat -ntlp | grep 9000
tcp        0      0 127.0.0.1:9000          0.0.0.0:*               LISTEN      21481/php-fpm: mast 
[root@node01 php-5.6.40]#

3.11 Configure php-fpm service auto-start

[root@node01 php-5.6.40]# systemctl enable php-fpm 
Created symlink from /etc/systemd/system/multi-user.target.wants/php-fpm.service to /usr/lib/systemd/system/php-fpm.service.
[root@node01 php-5.6.40]# 
[root@node01 php-5.6.40]# systemctl status php-fpm 
● php-fpm.service - The PHP FastCGI Process Manager
   Loaded: loaded (/usr/lib/systemd/system/php-fpm.service; enabled; vendor preset: disabled)
   Active: active (running) since Thu 2020-06-11 08:02:38 CST; 7min ago
 Main PID: 21481 (php-fpm)
   CGroup: /system.slice/php-fpm.service
           ├─21481 php-fpm: master process (/usr/local/php/etc/php-fpm.conf)
           ├─21482 php-fpm: pool www
           └─21483 php-fpm: pool www

Jun 11 08:02:38 node01 systemd[1]: Starting The PHP FastCGI Process Manager...
Jun 11 08:02:38 node01 systemd[1]: Started The PHP FastCGI Process Manager.
[root@node01 php-5.6.40]# 

3.12 Use systemctl to manage php-fpm

[root@node01 php-5.6.40]# systemctl start php-fpm  #Start Services
[root@node01 php-5.6.40]# systemctl status php-fpm  #View Status
[root@node01 php-5.6.40]# systemctl stop php-fpm  #Out of Service
[root@node01 php-5.6.40]# systemctl restart php-fpm  #Restart Service
[root@node01 php-5.6.40]# systemctl reload php-fpm  #Overload after modifying configuration file
[root@node01 php-5.6.40]# systemctl enable php-fpm  #Start-up self-start
[root@node01 php-5.6.40]# systemctl didable php-fpm  #Prohibit startup and self-startup

4. Deploy wordpress website

4.1 Upload wordpress website code

# Unpack to nginx publishing directory:
[root@node01 src]# tar xf wordpress-4.9.4-zh_CN.tar.gz -C /usr/local/nginx/html/ 
[root@node01 src]#
[root@node01 src]# chown -R nginx:nginx /usr/local/nginx/html/wordpress/
[root@node01 src]# 

4.2. Create a wordpress virtual host

# Specify the virtual host directory to apply (added under the main profile http instruction block):
include vhost/*.conf;
[root@node01 src]# vi /usr/local/nginx/conf/nginx.conf
#user  nobody;
user  nginx;
worker_processes  2;

#error_log  logs/error.log;
#error_log  logs/error.log  notice;
#error_log  logs/error.log  info;

#pid        logs/nginx.pid;
pid        /var/run/nginx.pid;

events {
    worker_connections  1024;
}

http {
    include       mime.types;
    default_type  application/octet-stream;

    log_format  main  '$remote_addr - $remote_user [$time_local] "$request" '
                      '$status $body_bytes_sent "$http_referer" '
                      '"$http_user_agent" "$http_x_forwarded_for"';

    access_log  logs/access.log  main;

    sendfile        on;
    #tcp_nopush     on;

    #keepalive_timeout  0;
    keepalive_timeout  65;

    #Configure Virtual Host Directory
    include       vhost/*.conf;
}

# Create a virtual host directory:
[root@node01 src]# mkdir -p /usr/local/nginx/conf/vhost
# Create a virtual host configuration file:
[root@node01 src]# vim /usr/local/nginx/conf/vhost/blog.wordpress.com.conf 
server {
        listen       80;
        server_name blog.wordpress.com;
        #charset koi8-r;
        access_log  logs/wordpress.access.log  main;
        location / {
            root   html/wordpress;
            index  index.php index.html index.htm;
        }
        #error_page  404              /404.html;
        # redirect server error pages to the static page /50x.html
        #
        error_page   500 502 503 504  /50x.html;
        location = /50x.html {
                root   html;
        }
        location ~ \.php$ {
            root           html/wordpress;
            fastcgi_pass   127.0.0.1:9000;
            fastcgi_index  index.php;
            fastcgi_param  SCRIPT_FILENAME  $document_root$fastcgi_script_name;
            include        fastcgi_params;
        }
}

4.3. Creating a wordpress database

# Start the database service:
[root@node01 src]# systemctl start mysqld
[root@node01 src]# 
# Enter the database to create the database and authorize:
[root@node01 src]# mysql
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 3
Server version: 5.7.30 MySQL Community Server (GPL)

Copyright (c) 2000, 2020, Oracle and/or its affiliates. All rights reserved.

Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

mysql> create database wordpress charset utf8;
Query OK, 1 row affected (0.00 sec)

mysql> grant all on wordpress.* to "wordpress"@"localhost" identified by "123456"; 
Query OK, 0 rows affected, 1 warning (0.01 sec)

mysql> flush privileges;
Query OK, 0 rows affected (0.00 sec)

mysql> 

4.4. Visit the wordpress website

hosts resolution 192.168.48.181 on physical machines (C:WindowsSystem32driversetchosts)Blog.wordpress.com

5. Deploy discuz website

5.1 Upload discuz website code

[root@node01 src]# rz
rz waiting to receive.
Starting zmodem transfer.  Press Ctrl+C to cancel.
Transferring Discuz_X3.4_SC_UTF8.zip...
  100%   11523 KB    11523 KB/sec    00:00:01       0 Errors  

[root@node01 src]#
# Unzip:
[root@node01 src]# unzip Discuz_X3.4_SC_UTF8.zip -d /usr/local/nginx/html/discuz
# To grant authorization:
[root@node01 src]# chown -R nginx:nginx /usr/local/nginx/html/discuz/
[root@node01 src]#

5.2 Create discuz virtual host configuration file

[root@node01 src]# vi /usr/local/nginx/conf/vhost/bbs.discuz.com.conf
server {
        listen       80;
        server_name bbs.discuz.com;
        #charset koi8-r;
        access_log  logs/discuz.access.log  main;
        location / {
            root   html/discuz/;
            index  index.php index.html index.htm;
        }
        #error_page  404              /404.html;
        # redirect server error pages to the static page /50x.html
        #
        error_page   500 502 503 504  /50x.html;
        location = /50x.html {
                root   html;
        }

        location ~ \.php$ {
            root           html/discuz/upload;
            fastcgi_pass   127.0.0.1:9000;
            fastcgi_index  index.php;
            fastcgi_param  SCRIPT_FILENAME  $document_root$fastcgi_script_name;
                 include        fastcgi_params;
        }
}

5.3. Create discuz database

[root@node01 src]# mysql
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 35
Server version: 5.7.30 MySQL Community Server (GPL)

Copyright (c) 2000, 2020, Oracle and/or its affiliates. All rights reserved.

Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

mysql> create database discuz charset utf8;
Query OK, 1 row affected (0.00 sec)

mysql> 
mysql> grant all on discuz.* to "discuz"@"localhost" identified by "123456";
Query OK, 0 rows affected, 1 warning (0.00 sec)

mysql> flush privileges;
Query OK, 0 rows affected (0.00 sec)

mysql> 

5.4 Visit discuz website

hosts resolution 192.168.48.181 on physical machines (C:WindowsSystem32driversetchosts)Bbs.discuz.com

[mark](http://img.lutixia.cn/blog/20191225/mnOCFmuohubo.png?imageslim

Posted by AAFDesign on Sat, 13 Jun 2020 15:24:55 -0700