当前位置:网站首页>LNMP architecture setup (deploy discuz Forum)
LNMP architecture setup (deploy discuz Forum)
2022-07-27 11:46:00 【Brother frog who doesn't look back】
Catalog
One 、Nginx Service installation
1 Preparation before experiment
4 Compilation and installation
1 install MySQL Environment dependent packages
3 Compilation and installation
4 modify MySQL The configuration file
5 change MySQL The primary group of the installation directory and configuration files
6 Set the path environment variable
8 add to mysqld system service
9 modify MySQL The login code of
3、 ... and 、 Installation configuration PHP Analyze the environment
1 Install environment dependency package
2 Compilation and installation
4 adjustment PHP The configuration file
4.2 Adjust the process configuration file
4.3 Adjust the extended profile
6 To configure Nginx Support PHP analysis
8 Verify that the database is working properly
3 Adjust the permissions of forum Directory
4.1 Administrator account login test
One 、Nginx Service installation
1 Preparation before experiment
systemctl stop firewalld Turn off firewall
systemctl disable firewalld Power on and off
setenforce 0 Turn off the enhancement mechanism 
2 Install dependency packages
yum -y install pcre-devel zlib-devel gcc gcc-c++ make
3 Create a running user
useradd -M -s /sbin/nologin nginx![]()
4 Compilation and installation
cd /opt
tar zxvf nginx-1.12.0.tar.gz -C /opt/''.6hvcf
cd nginx-1.12.0/
./configure \
--prefix=/usr/local/nginx \ Appoint Nginx Installation path for
--user=nginx \ Specify user name
--group=nginx \ Specify the group name
--with-http_stub_status_module Enable http_stub_status_module modular
make && make install


![]()
5 Optimize the path
ln -s /usr/local/nginx/sbin/nginx /usr/local/sbin/ Let the system recognize Nginx Operation command of ![]()
6 add to Nginx system service
vim /lib/systemd/system/nginx.service add to Nginx System service configuration
[Unit] The service name
Description=nginx Describe the service
After=network.target Describe the type of service
[Service] Service parameters
Type=forking Background operation form
PIDFile=/usr/local/nginx/logs/nginx.pid PID Path to file
ExecStart=/usr/local/nginx/sbin/nginx Start the service
ExecReload=/bin/kill -s HUP $MAINPID Restart the service
ExecStop=/bin/kill -s QUIT $MAINPID Out of Service
PrivateTmp=true Allocate temporary space to services
[Install]
WantedBy=multi-user.target The mode of serving users
chmod 754 /lib/systemd/system/nginx.service Grant authority
systemctl start nginx.service Opening service
systemctl enable nginx.service Set power on self start 

7 The verification results

Two 、 install MySQL service
1 install MySQL Environment dependent packages
yum -y install \
ncurses \
ncurses-devel \
bison \
cmake
2 Create a running user
useradd -M -s /sbin/nologin mysql![]()
3 Compilation and installation
cd /opt
tar zxvf mysql-boost-5.7.20.tar.gz
cd /opt/mysql-5.7.20/
cmake \
-DCMAKE_INSTALL_PREFIX=/usr/local/mysql \
-DMYSQL_UNIX_ADDR=/usr/local/mysql/mysql.sock \
-DSYSCONFDIR=/etc \
-DSYSTEMD_PID_DIR=/usr/local/mysql \
-DDEFAULT_CHARSET=utf8 \
-DDEFAULT_COLLATION=utf8_general_ci \
-DWITH_EXTRA_CHARSETS=all \
-DWITH_INNOBASE_STORAGE_ENGINE=1 \
-DWITH_ARCHIVE_STORAGE_ENGINE=1 \
-DWITH_BLACKHOLE_STORAGE_ENGINE=1 \
-DWITH_PERFSCHEMA_STORAGE_ENGINE=1 \
-DMYSQL_DATADIR=/usr/local/mysql/data \
-DWITH_BOOST=boost \
-DWITH_SYSTEMD=1
Compile and install
make -j4 && make install![]()

![]()
4 modify MySQL The configuration file
vim /etc/my.cnf
[client]
port = 3306
socket=/usr/local/mysql/mysql.sock
[mysqld]
user = mysql
basedir=/usr/local/mysql
datadir=/usr/local/mysql/data
port = 3306
character-set-server=utf8
pid-file = /usr/local/mysql/mysqld.pid
socket=/usr/local/mysql/mysql.sock
bind-address = 0.0.0.0
skip-name-resolve
max_connections=2048
default-storage-engine=INNODB
max_allowed_packet=16M
server-id = 1
sql_mode=NO_ENGINE_SUBSTITUTION,STRICT_TRANS_TABLES,NO_AUTO_CREATE_USER,NO_AUTO_VALUE_ON_ZERO,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,PIPES_AS_CONCAT,ANSI_QUOTES
5 change MySQL The primary group of the installation directory and configuration files
chown -R mysql:mysql /usr/local/mysql/
chown mysql:mysql /etc/my.cnf![]()
6 Set the path environment variable
echo 'export PATH=/usr/local/mysql/bin:/usr/local/mysql/lib:$PATH' >> /etc/profile
source /etc/profile![]()
7 Initialize database
cd /usr/local/mysql/bin/
./mysqld \
--initialize-insecure \ Generate initialization password is empty
--user=mysql \ Specify the administrative user
--basedir=/usr/local/mysql \ Specify the installation directory of the database
--datadir=/usr/local/mysql/data Specify the storage path of the database file 
8 add to mysqld system service
cp /usr/local/mysql/usr/lib/systemd/system/mysqld.service /usr/lib/systemd/system/
be used for systemctl Service management
systemctl daemon-reload Refresh recognition
systemctl start mysqld.service Opening service
systemctl enable mysqld Boot up 
9 modify MySQL The login code of
mysqladmin -u root -p password "123456" to root Set the password to 123456, The prompt is the original password ( It's empty )
10 Authorize remote login
mysql -u root -p
grant all privileges on *.* to 'root'@'%' identified by '123456';
# grant root Users can log in remotely at all terminals , The password used is 123456, And all databases and all tables have operation permissions
show databases; # View the existing database 
3、 ... and 、 Installation configuration PHP Analyze the environment
1 Install environment dependency package
install GD Kuhe GD Library correlator , Used to process and generate images
yum -y install gd \
libjpeg libjpeg-devel \
libpng libpng-devel \
freetype freetype-devel \
libxml2 libxml2-devel \
zlib zlib-devel \
curl curl-devel \
openssl openssl-devel
2 Compilation and installation
cd /opt
tar jxvf php-7.1.10.tar.bz2
cd php-7.1.10
./configure \
--prefix=/usr/local/php \
--with-mysql-sock=/usr/local/mysql/mysql.sock \
--with-mysqli \
--with-zlib \
--with-curl \
--with-gd \
--with-jpeg-dir \
--with-png-dir \
--with-freetype-dir \
--with-openssl \
--enable-fpm \
--enable-mbstring \
--enable-xml \
--enable-session \
--enable-ftp \
--enable-pdo \
--enable-tokenizer \
--enable-zip
make -j2 && make install![]()

![]()
3 Path optimization
ln -s /usr/local/php/bin/* /usr/local/bin/
ln -s /usr/local/php/sbin/* /usr/local/sbin/![]()
4 adjustment PHP The configuration file
4.1 Adjust the main profile
cp /opt/php-7.1.24/php.ini-development /usr/local/php/lib/php.ini
vim /usr/local/php/lib/php.ini
--1170 That's ok -- modify
mysqli.default_socket = /usr/local/mysql/mysql.sock
--939 That's ok -- uncomment , modify
date.timezone = Asia/Shanghai
php -m # Verify the installed module 
![]()

4.2 Adjust the process configuration file
cd /usr/local/php/etc/
cp php-fpm.conf.default php-fpm.conf
vim php-fpm.conf
--17 That's ok -- Get rid of ";" notes
pid = run/php-fpm.pid![]()

4.3 Adjust the extended profile
cd /usr/local/php/etc/php-fpm.d/
cp www.conf.default www.conf![]()
5 start-up php-fpm
/usr/local/php/sbin/php-fpm -c /usr/local/php/lib/php.ini
netstat -anpt | grep 9000![]()
PHP-FPM(FastCGI Process Manager:FastCGI Process Manager ) It's a PHPFastCGI Manager , because Nginx The server can't handle dynamic pages , Need by Nginx Give the dynamic request to php-fpm Process .
![]()
6 To configure Nginx Support PHP analysis
vim /usr/local/nginx/conf/nginx.conf
--65 That's ok -- uncomment , modify
location ~ \.php$ {
root html;
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME /usr/local/nginx/html$fastcgi_script_name; # take /scripts It is amended as follows nginx Working directory of
#fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; #$document_root On behalf of the current request root The value specified in the instruction
include fastcgi_params;
}
systemctl restart nginx.service
Restart the service
![]()
7 verification PHP Test page
vim /usr/local/nginx/html/index.php
<?php
phpinfo();
?>
Restart the service :systemctl restart nginx
Browser access

8 Verify that the database is working properly
mysql -u root -p
# Create a database
CREATE DATABASE bbs;
# hold bbs The permissions of all tables in the database are granted to bbsuser, And set the password 123456
GRANT all ON bbs.* TO 'bbsuser'@'%' IDENTIFIED BY '123456'; # Refresh database
flush privileges; # See what databases are
show databases;
vim /usr/local/nginx/html/index.php # Replace the content of the original test page
<?php
$link=mysqli_connect('192.168.152.11','bbsuser','123456');
if($link) echo "<h1>Success!!</h1>";
else echo "Fail!!";
?>

9 Browser access

Four 、 Deploy Discuz Forum
1 Unzip the forum package
cd /opt
unzip Discuz_X3.4_SC_UTF8.zip -d /opt/dis
![]()
2 Upload site update package
cd /opt/dis/dir_SC_UTF8/
cp -r upload/ /usr/local/nginx/html/bbs/![]()
3 Adjust the permissions of forum Directory
cd /usr/local/nginx/html/bbs/
chown -R nginx ./config/
chown -R nginx ./data/
chown -R nginx ./uc_client/
chown -R nginx ./uc_server/
or
chmod -R 777 ./config/
chmod -R 777 ./data/
chmod -R 777 ./uc_client/
chmod -R 777 ./uc_server/
4 Browser access verification
Forum page access
http://192.168.152.11/bbs/install/index.php
# Fill in the database information
database server :localhost ### It's built locally localhost, How not to fill in on this machine IP Address and port number
Database name :bbs
Database user name :bbsuser
Database password :123456
Administrator account :admin
Administrator password :123456
# end
# Forum internal page
http://192.168.152.11/bbs/index.php
# Forum background administrator page

Drop down to the end



4.1 Administrator account login test

4.2 Create an account test


边栏推荐
- PWM的原理和PWM波的产生
- shell编程之免交互
- Summary of leetcode SQL exercises (MySQL Implementation)
- Maker Hongmeng application development training notes 03
- Newton Raphson iterative method
- 1.Flume 简介及基本使用
- 剑指 Offer 笔记: T45. 把数组排成最小的数
- Adobe audit prompts that the sampling rate of audio input does not match the output device - problem solving
- JUC框架 从Runnable到Callable到FutureTask 使用浅析
- 【机器学习-白板推导系列】学习笔记---条件随机场
猜你喜欢

Why is ack=seq+1 when TCP shakes hands three times

Analysis of the use of JUC framework from runnable to callable to futuretask

第12章 泛型

Solution of digital tube flash back after proteus8 professional version cracking

Keil MDK编译出现..\USER\stm32f10x.h(428): error: #67: expected a “}“错误的解决办法

Basic use of cmake

第10章 枚举类与注解

When std:: bind meets this

Maker Hongmeng application development training 04

82. (cesium home) cesium points move on 3D models
随机推荐
TapNet: Multivariate Time Series Classification with Attentional Prototypical Network
一些MathType常用快捷键
Adobe audit prompts that the sampling rate of audio input does not match the output device - problem solving
Modelarts image classification and object detection
The C programming language (2nd) -- Notes -- 1.6
多家银行调整现金管理类理财产品申赎规则:申赎确认时效“T+0”变“T+1”
Beyond compare 3 next difference segment / down search arrow not found
局域网SDN技术硬核内幕 11 云网融合CP的关键——层次化端口绑定
(4) Operator
Analysis of the use of JUC framework from runnable to callable to futuretask
Analysis of distributed database and cache double write consistency scheme (Reprint)
多种进制之间的转换
EfficientNet
第13章 IO流
Installation and use of GTEST and gmock
箱型图介绍
VSCode复制代码时去掉样式/语法高亮/代码高亮/黑色背景
暂用 Solo,博客选择困难
Raw socket grabs packets, and packets on some ports cannot be caught
Could not load dynamic library ‘libcudnn.so.8‘;