Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

Enterprise actual combat LNMP high-performance server _ wordpress, discuz dual website deployment

2025-03-01 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

Shulou(Shulou.com)06/02 Report--

Enterprise actual combat LNMP high-performance server _ wordpress, discuz dual website deployment

In LNMP WEB architecture, Nginx is a high-performance WEB server, which can not handle PHP itself. When receiving a HTTP Request request sent by a client browser, the Nginx server responds and processes the WEB request. Static resource CSS, picture, video, TXT and other static file requests can be directly processed and responded to by the Nginx server.

However, the PHP dynamic page request Nginx cannot be processed directly. The Nginx server will transfer the PHP web page script to PHP-FPM (process manager) through the interface transfer protocol (gateway protocol) PHP-FCGI (Fast-CGI). PHP-FPM does not process it, and then PHP-FPM calls the PHP parser process, and the PHP parser parses the PHP script information. Multiple PHP parser processes can be started, and multiple processes can be executed concurrently.

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

1. Source code installation MySQL5.7.301.1 source code compilation before installation prepare 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-libs1.1.2 create user [root@node01 ~] # useradd-s / sbin/nologin-M mysql # prompt that mysql already exists and you can ignore this step 1.1.3 to create a directory and modify permissions [root@node01 ~] # mkdir-p / data/mysql

[root@node01 ~] # chown-R mysql.mysql / data1.1.4 install MySQL related dependency package [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-devel1.1.5 download source code and extract [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 are many changes after the update of version 5.7, for example, the boost library must be installed now for installation) [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

Description: decompression and other operations will be done when the program is compiled. Just download or copy the package here.

1.2Source Code 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=./boost1.2.2 compilation parameters introduce cmake\

-DBUILD_CONFIG=mysql_release\ # this option configures the source distribution using the same build options used by Oracle to generate a binary distribution of the official MySQL version.

-DCMAKE_BUILD_TYPE=RelWithDebInfo\ # Type of build to build = enable optimization and generate debugging information. This is the default MySQL build type.

The-DCMAKE_INSTALL_PREFIX=/usr/local/mysql\ # option indicates the basic installation directory.

-DMYSQL_DATADIR=/data/mysql\ # location of the MySQL data directory.

-DSYSCONFDIR=/etc\ # default my.cnf option file directory.

-DMYSQL_UNIX_ADDR=/tmp/mysql.sock\ # the Unix socket file path where the server listens for socket connections. This must be an absolute pathname. The 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;, which may change implicitly depending on the INSTALL_LAYOUT value.

-DMYSQL_USER=mysql\ # specify the startup user of 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 the port number for MySQL snooping

-DENABLED_LOCAL_INFILE=1\ # enables the mysql client to have the function of load data infile, which has the security risk of reading load data infile statements into a table from a text file at a high speed

The path to the DENABLE_DOWNLOADS=1\ # googlemock distribution for Google Test-based unit testing. = 1 CMake will download the distribution 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\ # does not include debugging support.

-DMYSQL_MAINTAINER_MODE=0\ # whether to enable the MySQL maintainer-specific development environment. If enabled, this option causes the compiler warning to become an error.

-DWITH_SSL:STRING=system\

-DWITH_ZLIB:STRING=bundled\

-DDOWNLOAD_BOOST=1\ # whether to download the Boost library. The default is OFF.

-DWITH_BOOST=./boost # specifies the location of the Boost library directory. 1.2.3 check whether there is an exception in compilation [root@node01 mysql-5.7.30] # echo $? # if the result returned is 0, there is no exception in compilation. 1.2.4 Source Code installs [root@node01 mysql-5.7.30] # make & & make install

It's a long process. Wait patiently.

1.2.5 check to see if there is any exception in the installation [root@node01 mysql-5.7.30] # echo $? # if the returned result is 0, the source code is compiled without exception. 1.3.1 add systemd service control [root@node01 mysql-5.7.30] # cp. / scripts/mysqld.service / usr/lib/systemd/system1.3.2 add environment variable [root@node01 mysql-5. 7.30] # cat > / etc/profile.d/mysql.sh / etc/profile.d/nginx.sh / etc/profile.d/php.sh 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

Do the hosts parsing 192.168.48.181 blog.wordpress.com on the physical machine (C:\ Windows\ System32\ drivers\ etc\ hosts)

5. Deploy discuz site 5.1 upload discuz site Code [root@node01 src] # rz

Rz waiting to receive.

Starting zmodem transfer. Press Ctrl+C to cancel.

Transferring Discuz_X3.4_SC_UTF8.zip...

11523 KB 11523 KB/sec 00:00:01 0 Errors

[root@node01 src] #

# decompress:

[root@node01 src] # unzip Discuz_X3.4_SC_UTF8.zip-d / usr/local/nginx/html/discuz

# Licensing:

[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 the discuz website

Do the hosts parsing 192.168.48.181 bbs.discuz.com on the physical machine (C:\ Windows\ System32\ drivers\ etc\ hosts)

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Servers

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report