当前位置:网站首页>Lnmp+discuz Forum
Lnmp+discuz Forum
2022-07-27 01:33:00 【JXin-xxx】
LNMP+DISCUZ Forum

------------------------------ install Nginx service -------------------------------
Close the protective wall
[[email protected] opt]# systemctl stop firewalld
[[email protected] opt]# systemctl disable firewalld
Removed symlink /etc/systemd/system/multi-user.target.wants/firewalld.service.
Removed symlink /etc/systemd/system/dbus-org.fedoraproject.FirewallD1.service.
[[email protected] opt]# setenforce 0
Install dependency packages
#nginx The configuration and operation of pcre、zlib And so on , Therefore, you need to install the development package of these software , In order to provide the corresponding library and header file .
yum -y install pcre-devel zlib-devel gcc gcc-c++ make
Create a running user 、 Group
#Nginx The service program defaults to nobody Identity running , It is recommended to create a special user account for it , In order to more accurately control its access rights
useradd -M -s /sbin/nologin nginx
Configuration software module
[[email protected] opt]# tar zxf nginx-1.12.2.tar.gz # Unpack
[[email protected] opt]# cd nginx-1.12.2/
[[email protected] nginx-1.12.2]# ./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 Module to support status statistics operations
Compilation and installation Nginx
make -j2 && make install
Optimize the configuration file path , It's easy for the system to identify nginx Operation command of
ln -s /usr/local/nginx/sbin/nginx /usr/local/sbin/ # Let the system recognize nginx Operation command of
add to Nginx service
vim /lib/systemd/system/nginx.service
[Unit]
Description=nginx
After=network.target
[Service]
Type=forking
PIDFile=/usr/local/nginx/logs/nginx.pid
ExecStart=/usr/local/nginx/sbin/nginx
ExecReload=/bin/kill -s HUP $MAINPID
ExecStop=/bin/kill -s QUIT $MAINPID
PrivateTmp=true
[Install]
WantedBy=multi-user.target
chmod 754 /lib/systemd/system/nginx.service
systemctl start nginx.service
systemctl enable nginx.service
------------------------------ install MySQL service -------------------------------

install Mysql Environment dependent packages
yum -y install \
gcc \
gcc-c++ \
ncurses \ # Dynamic library of graphic interaction function under character terminal
ncurses-devel \ #ncurses Development kit
bison \ # parsers
cmake #mysql Need to use cmake Compilation and installation
or
yum -y install gcc gcc-c++ ncurses ncurses-devel bison cmake
Configuration software module
tar zxvf mysql-5.7.17.tar.gz -C /opt
tar zxvf boost_1_59_0.tar.gz -C /usr/local/
cd /opt
mv /usr/local/boost_1_59_0 /usr/local/boost # rename
cd /opt/mysql-5.7.17/
cmake \
-DCMAKE_INSTALL_PREFIX=/usr/local/mysql \ # Appoint mysql Installation path for
-DMYSQL_UNIX_ADDR=/usr/local/mysql/mysql.sock \ # Appoint mysql The process listens to socket files ( Database connection file ) Storage path for
-DSYSCONFDIR=/etc \ # Specify the storage path of the configuration file
-DSYSTEMD_PID_DIR=/usr/local/mysql \ # Specifies the storage path of the process file
-DDEFAULT_CHARSET=utf8 \ # Specifies the default character set encoding , Such as utf8
-DDEFAULT_COLLATION=utf8_general_ci \ # Specifies the character set collation rules to be used by default
-DWITH_EXTRA_CHARSETS=all \ # Specify support for other character set encoding
-DWITH_INNOBASE_STORAGE_ENGINE=1 \ # install INNOBASE Storage engine
-DWITH_ARCHIVE_STORAGE_ENGINE=1 \ # install ARCHIVE Storage engine
-DWITH_BLACKHOLE_STORAGE_ENGINE=1 \ # install BLACKHOLE Storage engine
-DWITH_PERFSCHEMA_STORAGE_ENGINE=1 \ # install FEDERATED Storage engine
-DMYSQL_DATADIR=/usr/local/mysql/data \ # Specify the storage path of the database file
-DWITH_BOOST=/usr/local/boost \ # Appoint boost The path of , If you use mysql-boost Integration package installation is
-DWITH_BOOST=boost
-DWITH_SYSTEMD=1 # Generation facilitates systemctl Administrative document
Compilation and installation
make -j 3 && make install
It takes a long time to wait ,-j 3 Represents compiling with two cores
Create common user management mysql, Change management master / Group
[[email protected] mysql-5.7.17]# useradd -s /sbin/nologin mysql
[[email protected] mysql-5.7.17]# chown -R mysql:mysql /usr/local/mysql/
[[email protected] mysql-5.7.17]# chown mysql:mysql /etc/my.cnf
Modify the configuration file
vim /etc/my.cnf # Delete the original configuration item , Add the following again
[client] # Client side Settings
port = 3306
socket=/usr/local/mysql/mysql.sock
[mysqld] # Service global settings
user = mysql # Set up administrative users
basedir=/usr/local/mysql # Specify the installation directory of the database
datadir=/usr/local/mysql/data # Specify the storage path of the database file
port = 3306 # Designated port
character-set-server=utf8 # Set the server character set encoding format to utf8
pid-file = /usr/local/mysql/mysqld.pid # Appoint pid Process file path
socket=/usr/local/mysql/mysql.sock # Specify the database connection file
bind-address = 0.0.0.0 # Set listening address ,0.0.0.0 The representative allows all , If multiple IP It needs to be separated by spaces
skip-name-resolve # Ban DNS analysis
max_connections=2048 # Set up mysql Is the maximum number of connections
default-storage-engine=INNODB # Specify the default storage engine
max_allowed_packet=16M # Set the maximum packet size received by the database
server-id = 1 # Designated Services ID Number
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
Set the path environment variable
echo 'export PATH=/usr/local/mysql/bin:/usr/local/mysql/lib:$PATH' >> /etc/profile
# Set the path environment variable , Append to the global environment variable
source /etc/profile # Refresh global variables
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
Set up 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
netstat -anpt | grep 3306 # Check the port

to root Account setup password
[[email protected] bin]# mysqladmin -u root -p password "123456"

-------------------------------------- install PHP-----------------------------
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
Configuration software module
tar zxf php-7.1.24.tar.gz
cd /opt/php-7.1.24/
./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
Compile and install
make -j3 && make install
Copy the template file as PHP Primary profile for , And make changes
cp /opt/php-7.1.24/php.ini-development /usr/local/php/php.ini
# Use... In the test environment php.ini-development file , And in the production environment php.ini-production file
vim /usr/local/php/php.ini
--939 That's ok -- uncomment , modify
date.timezone = Asia/Shanghai
--1170 That's ok -- modify
mysqli.default_socket = /usr/local/mysql/mysql.sock
Optimize PHP The executable program file of is put into the directory of path environment variable to facilitate system identification
[[email protected] php-7.1.24]# ln -s /usr/local/php7/sbin/* /usr/local/sbin
[[email protected] php-7.1.24]# ln -s /usr/local/php7/bin/* /usr/local/bin # hold php The executable program of is put into the path environment variable , It's easy for the system to identify
[[email protected] php-7.1.24]# php -m # see php Which modules are loaded
Process service profile php-fpm.conf
cd /usr/local/php/etc/
cp php-fpm.conf.default php-fpm.conf
vim /usr/local/php/etc/php-fpm.conf
17 Line uncomment pid = run/php-fpm.pid
Extended profile www.conf
cd /usr/local/php/etc/php-fpm.d/
cp www.conf.default www.conf

start-up php-fpm
ln -s /usr/local/php/sbin/* /usr/local/sbin
/usr/local/php/sbin/php-fpm -c /usr/local/php/lib/php.ini
netstat -anpt | grep 9000

modify nginx The configuration file for the service , Give Way nginx Support PHP
vim /usr/local/nginx/conf/nginx.conf
--45 That's ok , add to index.php
location / {
root html;
index index.html index.htm index.php;
}
--65 Row to 71 That's ok -- uncomment , modify
location ~ \.php$ {
root html;
fastcgi_pass 127.0.0.1:9000; #php-fpm Communication port ,php-fpm service
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



verification PHP Test page
[[email protected] php-fpm.d]# vim /usr/local/nginx/html/index.php
<?php
phpinfo();
?>
----》:wq
[[email protected] conf]# systemctl restart nginx

Deploy Discuz Community BBS
Create a database
mysql -u root -p
mysql> CREATE DATABASE bbs;
# hold bbs The permissions of all tables in the database are granted to bbsuser, And set the password
mysql> GRANT all ON bbs.* TO 'bbsuser'@'%' IDENTIFIED BY '123456';
# Refresh database
mysql>flush privileges;
mysql> show databases; # Check the existing database
mysql> grant all privileges on *.* to 'root'@'%' identified by '123456'; # to grant authorization root Users can log in remotely at all terminals , The password for 123456, And all databases and all tables have operation permissions
Drag the software package required by the forum into /opt Under the table of contents , And extract the
unzip Discuz_X3.4_SC_UTF8.zip -d /opt/dis
Upload site update package
cd dis/dir_SC_UTF8/
cp -r upload/ /usr/local/nginx/html/bbs
Change the owner of the rotation directory
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/
chmod -R 777 ./config/
chmod -R 777 ./data/
chmod -R 777 ./uc_client/
chmod -R 777 ./uc_server/
Forum page access , install Discuz Forum
Forum page access
http://20.0.0.55/bbs/install/index.php
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





loading Discuz Forum
Forum page access
http://20.0.0.55/bbs/install/index.php
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
[ Outside the chain picture transfer in …(img-i1NLLAqQ-1658644770139)]
[ Outside the chain picture transfer in …(img-XAF4KfDB-1658644770139)]
[ Outside the chain picture transfer in …(img-KcHOTPhK-1658644770140)]
[ Outside the chain picture transfer in …(img-ESwjqERv-1658644770140)]
[ Outside the chain picture transfer in …(img-YvGqWrZ5-1658644770140)]

边栏推荐
- Basic DOS commands
- Play guest cloud with zerotier nanny level teaching to ensure learning waste
- SQL relational algebra - Division
- 最大公约数的求法
- Introduction to various development software of advanced language
- Shortcut key introduction
- 集中式版本控制工具代码合并问题
- Mqtt---- bottom (precautions)
- Promoting practice with competition - Reflection on the 303th weekly match
- Markdown grammar learning summary
猜你喜欢
随机推荐
Basic syntax of Verilog
Play guest cloud brush machine 5.9
MySQL closes the problem of automatic submission of connection transactions
ESP8266 STA_ UDP_ Client
Jenkins -- Basic -- 5.1 -- system configuration -- plug-in management
Jenkins -- Foundation -- 02 -- Installation
MySQL关闭连接事务自动提交的问题
Unity UGUI Text文本框自适应
11、 Echo
ESP8266-----SNTP获取网络时间
Esp8266----- SNTP get network time
SQL relational algebra - Division
7. Formula F1 champion
ESP8266 AP_TCP_Client
iptables 防火墙(一)
Problem feedback: the synchronization of mobile app failed: the external changes of the data warehouse were damaged. The iPad app also downloaded the warehouse as soon as it was opened, and then flash
Summary of heap sorting related knowledge
Introduction to various development software of advanced language
Plantcv Chinese document
Unity a user-friendly UI grayscale shader



![数学建模简介-从现实对象到数学建模[2]](/img/b5/595a4e9a9a59ab57f541d3e21fba49.jpg)





![[unity] unity interface scene view [1]](/img/5a/c34ff09ef1ddba4b65c7873775c251.png)