LNMP project site to build combat -WordPress

LNMP project combat:
L: Linux (CentOS 7.6) http://mirrors.cqu.edu.cn/CentOS/7.6.1810/isos/x86_64/
N: Nginx (1.12.2) https://nginx.org/en /download.html
M: the MySQL (5.6.43) https://dev.mysql.com/downloads/mysql/5.6.html#downloads
P: the PHP (7.2.15) http://php.net/downloads.php
Worldpress (5.0.3): https://cn.wordpress.org/download/

-----
ready virtual models

192.168.55.3 nginx PHP-FPM
192.168.55.5 MySQL
preparation package ****
MariaDB-10.2.23-Linux-x86_64.tar.gz
WordPress-5.2.tar.gz
xvf PHP- 7.3.2.tar.xz
nginx-1.12.2.tar.gz
compile MySQL
1 to prepare users and groups
groupadd -r -g 336 mysql create a user group to gid 336
useradd -r -g MySQL -u 336 -s / sbin / nologin -d / data / mysql mysql
to create a directory created for the user gid 336 -s shell type

Preparation 2 binary files and related files attributes
the tar xvf MariaDB-10.2.23-Linux-x86_64.tar.gz -C / usr / local /
CD / usr / local /
LN -s-10.2.23-Linux-MariaDB the x86_64 / MySQL
chown -R & lt root.root / usr / local / MySQL /

3 PATH variable
CAT /etc/profile.d/mysql.sh
the PATH = / usr / local / MySQL / bin: $ the PATH

4 Preparing the database data directory and data
mkdir / Data / MySQL -pv
chown mysql.mysql / Data / MySQL /
CD / usr / local / MySQL
./scripts/mysql_install_db --datadir = / Data / MySQL --user = MySQL

Preparation of 5 Mysql server configuration file
mkdir / etc / MySQL
CP /usr/local/mysql/support-files/my-huge.cnf /etc/mysql/my.cnf
Vim /etc/mysql/my.cnf
[mysqld]
datadir = / data / mysql his party

6 ready to serve startup script
cp /usr/local/mysql/support-files/mysql.server /etc/init.d/mysqld
chkconfig --add mysqld to mysqld accession process
service mysqld start

7 go in and create wordpress mysql database authorized users
to create a database
CREATE DATABASE wordpress;
create php connection to the database user
create user 'wordpress' @ '192.168.55.3 ' identified by '123456';
authorized 192.168.55.3 user login
GRANT ALL PRIVILEGES ON wordpress. the tO * "WordPress" @ "192.168.55.3" the IDENTIFIED bY "123456";
the FLUSH PRIVILEGES;
compiled and installed php
. 1 decompression
tar xvf php-7.3.2.tar.xz
source 2 installed php required
yum install libxml2-devel bzip2- libmcrypt -Y-devel devel
yum the install OpenSSL-devel.x86_64
. 3 php directory compiled into the
./configure --prefix=/app/php --enable-mysqlnd --with-mysqli=mysqlnd --with-pdo-mysql=mysqlnd --with-openssl --with-freetype-dir --with-jpeg-dir --with-png-dir --with-zlib --with-libxml-dir=/usr --with-config-file-path=/etc --with-config-file-scan-dir=/etc/php.d --enable-mbstring --enable-xml --enable-sockets --enable-fpm --enable-maintainer-zts --disable-fileinfo
make -j 4 && make install
4 修改配置文件
cd /app/php/etc/php-fpm.d/
cp www.conf.default www.conf
cp /data/php-7.3.5/php.ini-production /app/php/etc/php.ini
5添加用户用户组
useradd www -s /sbin/nologin -u 1001
6grep -v ";" www.conf | grep -v "^$"

7 set configuration content
mdkir / app / php / log / log file path
CD / App / PHP / etc /
CP-fpm.conf.default PHP-PHP fpm.conf
7 and starts checking the syntax PHP
/ App / PHP / sbin / PHP -t -fpm
/ App / PHP / sbin / PHP-FPM -c /app/php/etc/php.ini
PS -ef | grep PHP-FPM
netstat -tanlp | grep PHP-FPM
compile and install nginx
1 download nginx needs file
yum install -y vim lrzsz tree screen psmisc lsof tcpdump wget ntpdate gcc gcc-c ++ glibc glibc-devel pcre pcre-devel openssl openssl-devel systemd-devel net-tools iotop bc zip unzip zlib-devel bash-completion nfs-utils automake the libxml2-devel the libxslt the libxslt the libxml2-devel-Perl Perl the ExtUtils the Embed-
2 packet decompression nginx
CD / usr / local / the src /
the tar-xvf nginx 1.12.2.tar.gz
CD-1.12.2 nginx /
. 3 compiler installation
./configure --prefix = / apps / nginx --user = nginx --group = nginx --with-http_ssl_module --with-http_v2_module --with-http_realip_module --with-http_stub_status_module --with-http_gzip_static_module --with- pcre --with-stream --with-stream_ssl_module --with -stream_realip_module
compiled begin
make
create a directory and copy the generated module files to the appropriate directory and
make install
mkdir / the Data / nginx / WordPress -p
4 ready to test php page
[S1 the root @ ~] # Vim /data/nginx/wordpress/index.php
<PHP?
the phpinfo ();
?>

配置nginx
grep -v "#" /application/nginx-1.14.2/conf/nginx.conf | grep -v "^$"

cat /apps/nginx-1.12.2/conf/nginx.conf
server {
listen 80;
server_name www.magedu.net;
location / {
root /data/nginx/wordpress;
index index.php index.html index.htm;
if ($http_user_agent ~ "ApacheBench|WebBench|TurnitinBot|Sogou web
spider|Grid Service") {
#proxy_pass http://www.baidu.com;
return 403;
}
}
location ~ .php$ {
root /data/nginx/wordpress;
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;
}
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root html;
}
}

Deployment WordPress
CD / Data / Nginx / WordPress /
Music Videos the index.php / opt /
decompression WordPress
the tar-xvf WordPress 5.2.tar.gz
Music Videos WordPress / *.
Music Videos WordPress WordPress-5.2.tar.gz / opt /
CP WP-config- sample.php wp-config.php
modify the configuration file wp-config.php
vim /data/nginx/wordpress/wp-config.php
// MySQL settings - specific information from the host you are using //
/ name of the WordPress database * /
the DEFINE ( 'DB_NAME', 'WordPress');
/ * MySQL database user name /
the DEFINE ( 'DB_USER', 'WordPress');
/
MySQL database password * /
the DEFINE ( 'DB_PASSWORD', '123456');
/ * MySQL host /
DEFINE ( 'DB_HOST', '192.168.55.5');
Change your group
chown www.www /data/nginx/wordpress/ apps/nginx/ -R
/apps/nginx/sbin/nginx -s reload

Access web page
http://www.magedu.net/index.php

Reproduced in: https: //blog.51cto.com/14234910/2402935

Guess you like

Origin blog.csdn.net/weixin_34376562/article/details/91694854
Recommended