In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-04-02 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >
Share
Shulou(Shulou.com)06/01 Report--
This article will explain in detail how to build a Discuz forum about LNMP architecture. The content of the article is of high quality, so the editor will share it with you for reference. I hope you will have a certain understanding of the relevant knowledge after reading this article.
Building Nginx of Discuz Forum based on LNMP Architecture
Features: stability, lightweight, high concurrency, low resources
Advantages: good at dealing with static websites (pictures, text, videos and other files) access resources, Apache is good at dynamic (for example: account registration interaction)
LNMP platform is the combined architecture of Linux, Ngnix, MySQL and PHP, which requires Linux server, MySQL database and PHP parsing environment.
The fpm module in PHP in LNMP platform is responsible for processing dynamic resources.
Installation of PHP parsing environment
There are two ways to configure static and dynamic separation of web pages and parse PHP
● uses PHP's FPM module
● transfers the Web request to access the PHP page to the Apache server for processing
The newer version of PHP has its own FPM module, which is used to manage PHP parsing instances and optimize parsing efficiency.
● FastCGI separates Http Server from dynamic scripting languages to achieve cross-platform
● Nginx handles static requests and forwards dynamic requests; PHP_FPM specializes in parsing PHP dynamic requests
Single-server LNMP architecture usually uses FPM to parse PHP
The following is the process of manually compiling and building LNMP architecture and building discuz forums:
[root@localhost ~] # ls tar/LNMP-C7/
Discuz_X3.4_SC_UTF8.zip php-7.1.10.tar.bz2
Mysql-boost-5.7.20.tar.gz php-7.1.20.tar.bz2
Ncurses-5.6.tar.gz php-7.1.20.tar.gz
Nginx-1.12.2.tar.gz zend-loader-php5.6-linux-x86_64_update1.tar.gz
Php-5.6.11.tar.bz2
= Nginx manual compilation and installation =
1. Install related environment packages
Yum install-y gcc gcc-c++ pcre* zlib-devel make
two。 Decompress
Tar zxf nginx-1.12.2.tar.gz-C / opt/
Cd / opt/nginx-1.12.2/
3. Specify users and do not create home directories
Useradd-M-s / sbin/nologin nginx
4. Configuration
. / configure\
-- prefix=/usr/local/nginx\ / / specify a directory
-- user=nginx\ / / create users and groups
-- group=nginx\
-- with-http_stub_status_module / / Monitoring module
5. Compilation and installation
Make & & make install
6. Create a soft link
Ln-s / usr/local/nginx/sbin/nginx / usr/local/sbin/
7. Convenient for service control by service
Vim / lib/systemd/system/nginx.service
[Unit]
Description=nginx / / description information
After=network.target / / describe the service category
[Service]
Type=forking / / background operation mode
PIDFile=/usr/local/nginx/logs/nginx.pid / / pid file location
ExecStart=/usr/local/nginx/sbin/nginx / / start the service
ExecReload=/usr/bin/kill-s HUP $MAINPID / / configured according to pid overload
ExecStop=/usr/bin/kill-s QUIT $MAINPID / / terminate the process according to pid
PrivateTmp=true
[Install]
WantedBy=multi-user.target
Chmod 754 / lib/systemd/system/nginx.service
Systemctl start nginx.service
Netstat-ntap | grep 80
Systemctl stop firewalld.service
Setenforce 0
Conduct a host web page test to see if it is successful
= mysql manual compilation and installation =
Mysql service
1. Environmental installation
Yum install-y ncurses ncurses-devel bison cmake
/ / ncurses character terminal package bison function library cmake-- is used for compilation
two。 Create a user
Useradd-s / sbin/nologin mysql
3. Decompress
Cd ~ / tar/LNMP-C7/
Tar zxf mysql-boost-5.7.20.tar.gz-C / opt/
4. Configuration parameters
Cd / opt/mysql-5.7.20/
Cmake\
-DCMKAE_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_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
5. Compilation and installation
Make
Make install
6. Set up owners and groups
Cd / usr/local/
Chown-R mysql.mysql mysql/
7. Adjust the configuration file
Vim / etc/my.cnf
[client] / / client
Port = 3306
Default-character-set=utf8
Socket = / usr/local/mysql/mysql.sock
[mysql] / / client
Port = 3306
Default-character-set=utf8
Socket = / usr/local/mysql/mysql.sock
[mysqld] / / Server
User = mysql / / user
Basedir = / usr/local/mysql / / set the installation directory for mysql
Datadir = / usr/local/mysql/data / / sets the directory where the data in the mysql database is stored
Port = 3306 / / set port 3306
Character_set_server=utf8 / / Chinese character set
Pid-file = / usr/local/mysql/mysqld.pid / / pid file path
Socket = / usr/local/mysql/mysql.sock / / sock file path
Server-id = 1 / / Master-Slave parameter
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 / / support module
Chown mysql.mysql / etc/my.cnf
8. Set environment variables (can be set to soft links in scripts)
Echo 'PATH=/usr/local/mysql/bin:/usr/local/mysql/lib:$PATH' > > / etc/profile
Echo 'export PATH' > > / etc/profile
Source / etc/profile
9. Initialize the database
Cd / usr/local/mysql/
Bin/mysqld\
-- initialize-insecure\
-- user=mysql\
-- basedir=/usr/local/mysql\
-- datadir=/usr/local/mysql/data
Cp usr/lib/systemd/system/mysqld.service / lib/systemd/system/
/ / copy the MySQL service configuration file to / usr/lib/systemd/system/ for easy management using systemctl
10. Start the service
Systemctl start mysqld.service
11. Set the password to 123456
Mysqladmin-uroot-p password
Enter (123456)
= php manual compilation and installation =
Php:
Cd ~ / tar/LNMP-C7/
1. Environmental installation
Yum install-y\
Libjpeg\
Libjpeg-devel\
Libpng libpng-devel\
Freetype freetype-devel\
Libxml2 libxml2-devel\
Zlib zlib-devel\
Curl curl-devel\
Openssl openssl-devel
two。 Decompress
Tar jxf php-7.1.10.tar.bz2-C / opt/
Cd / opt/php-7.1.10/
3. Configuration parameters
. / 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
4. Compilation and installation
Make & & make install
5.php has three profiles php.ini core profile php-fpm.conf process service profile www.conf extension profile
Cp php.ini-development / usr/local/php/lib/php.ini
Vim / usr/local/php/lib/php.ini
1170:mysqli.default_socket = / usr/local/mysql/mysql.sock
939:date.timezone = Asia/Shanghai
6. Configure and optimize the FPM module
Cd / usr/local/php/etc/
Cp php-fpm.conf.default php-fpm.conf
Vim php-fpm.conf
17:pid = run/php-fpm.pid
Cd php-fpm.d/
Cp www.conf.default www.conf
/ usr/local/php/sbin/php-fpm-c / usr/local/php/lib/php.ini
Ln-s / usr/local/php/bin/* / usr/local/bin/
7. Let Nginx support PHP function
Vim / usr/local/nginx/conf/nginx.conf
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
Include fastcgi_params
}
Systemctl restart nginx.service
Cd / usr/local/nginx/html/
Mv index.html index.php
Vim index.php
Cat index.php
= create database mydb=
Mysql-uroot-p
Create database mydb
Grant all on mydb. To 'mydbuser'@'%' identified by' 123123'
Grant all on mydb. To 'mydbuser'@'localhost' identified by' 123123'
Flush privileges
Quit
= discuz forum building is similar to LANM =
Discuz Forum
Cd ~ / tar/LNMP-C7/
Unzip Discuz_X3.4_SC_UTF8.zip-d / opt/
Cd / opt/dir_SC_UTF8/
Cp-r upload/ / usr/local/nginx/html/mydb
Cd / usr/local/nginx/html/mydb/
Chown-R root:nginx. / config/
Chown-R root:nginx. / data/
Chown-R root:nginx. / uc_client/
Chown-R root:nginx. / uc_server/
Chmod-R 777. / config/
Chmod-R 777. / data/
Chmod-R 777. / uc_client/
Chmod-R 777. / uc_server/
= verify whether the erection is successful =
Http://192.168.68.149/mydb/install/index.php
Installation path
Http://192.168.68.149/mydb/index.php
Forum page
Http://192.168.68.149/mydb/admin.php
Manage login interface
Http://192.168.68.149/mydb/admin.php?
Administrator page
The final result is as follows:
On the LNMP architecture of the Discuz forum building is shared here, I hope that the above content can be of some help to you, can learn more knowledge. If you think the article is good, you can share it for more people to see.
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.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.