当前位置:网站首页>Lamp+discuz Forum
Lamp+discuz Forum
2022-07-27 01:34:00 【JXin-xxx】
LAMP+DISCUZ Forum
WEB The server is also known as WWW(WORLD WIDE WEB, web ) The server , The main function is to provide online information browsing services .
common web The server (web):
httpd(apache)、nginx+PHP
tomcat: jsp + html
win:IIS
LAMP=Linux Apache Mysql PHP Medium Apache(HTTPD) class LINUX System
Linux+Apache+Mysql/MariaDB+Perl/PHP/Python A set of tools commonly used to build dynamic websites or servers
Source software , They are independent procedures , But because it's often used together , Higher and higher compatibility , Together, a powerful Web Application platform .
LAMP Introduction and Overview
LAMP Platform Overview
LAMP Architecture is one of the mature enterprise website application modes , It refers to a whole system and related software working together , Can provide dynamic web Site service and its application development environment .
LAMP It's an abbreviation , Specific include Linux operating system ,Apache Web server ,MySQL database server ,PHP( or perl,Python) Web programming language .
structure LAMP Platform sequence
In the build LAMP Platform time , The installation sequence of each component is Linux,Apache,MySQL,PHP
among Apache and MySQL There is no strict sequence requirement for the installation of , and PHP The installation of the environment is usually at the end of the day , Responsible for communication web Servers and database systems to work together .
Advantages of compiling and installing
1、 With a large degree of freedom , Features can be customized
2、 Timely access to the latest software version
3、 Generally applicable to most Linux edition , Easy to use all the time
The main function of each component
( platform )Linux: As LAMP The foundation of Architecture , Provide for support Web The operating system of the site , Can provide better stability with the other three components , Compatibility (AMP Components also support Windows、UNIX Such as platform ) .
( The front desk )Apache: As LAMP The front end of the architecture , It's a powerful , Stable Web Server program , The server provides website access directly to users , Send web page , Pictures, etc .
( backstage )MySQL: As LAMP The back end of the architecture , Is a popular open source relational database system . On the corporate website 、 Business systems and other applications , All kinds of account information 、 Product information , Customer information 、 Business data can be stored in MySQL database , Other programs can be done through SQL Statement to query , Change this information .
( The middle link )PHP/Perl/Python: As three programming languages for developing dynamic web pages , Responsible for interpreting dynamic web files , Responsible for communication Web Servers and database systems to work together , And provide Web Application development and running environment . among PHP Is a widely used open source multi-purpose scripting language , It can be embedded in HTML in , Especially suitable for Web application development .
LAMP Architecture description


HTTPD service
httpd Directory structure of the service
Service catalog :/usr/local/httpd/
Master profile :/usr/local/httpd/conf/httpd.conf
Web page directory :/usr/local/httpd/htdocs/
Service script :/usr/local/httpd/bin/apachectl
Execution procedure :/usr/local/httpd/bin/httpd
Access log :/usr/local/httpd/log/access_log
Error log :/usr/local/httpd/log/error_log
httpd.conf Profile parameters
Common global configuration parameters
ServerRoot: Service catalog
Listen: Monitoring IP Address 、 Port number
User: The identity of the user running the service
Group: The identity of the group running the service
ServerAdmin: Administrator mailbox
ServerName: Domain name of the web server
DocumentRoot: The root directory of the web document
Directorylndex: Default index page file
ErrorLog: Set the path of the error log file
LogLevel: The level of logging , The default is warn
CustomLog: Where to access the log file
PidFile: preservation httpd process PID Document No
·AddDefaultCharset: Set the default character set encoding of web pages in the site
Timeout: Network connection timeout , The default is 300 second KeepAlive: Keep connected , Optional On or Off
MaxKeepAliveRequests: The maximum number of files requested per connection KeepAliveTimeout: Timeout to stay connected
Include: Other configuration files that need to be included
----------------------------------- install Apache--------------------------------------
Preparation before experiment ,/opt Prepare the required installation package

Turn off firewall
[[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 environment dependency package
yum -y install \
gcc \ #C Compiler of language
gcc-c++ \ #C++ The compiler
make \ # Source code compiler ( Convert source code to binary file )
pcre \ #pcre It's a Perl function library , Include perl Compatible regular expression library
pcre-devel \ #perl Interface development package for
expat-devel \ # Used to support website parsing HTML、XML file
perl #perl Language compilation
or
yum -y install gcc gcc-c++ make pcre pcre-devel expat-devel perl
Configuration software module
cd /opt/
tar zxvf apr-1.6.2.tar.gz
tar zxvf apr-util-1.6.0.tar.gz
tar jxvf httpd-2.4.29.tar.bz2
mv apr-1.6.2 /opt/httpd-2.4.29/srclib/apr
mv apr-util-1.6.0 /opt/httpd-2.4.29/srclib/apr-util
cd /opt/httpd-2.4.29/
./configure \
--prefix=/usr/local/httpd \ # Specify the httpd The installation path of the service program
--enable-so \ # Enable dynamic load module support , send httpd With the ability to further expand functions
--enable-rewrite \ # Enable Web address rewriting , For website optimization 、 Security chain and directory migration maintenance
--enable-charset-lite \ # Start character set support , To support pages encoded with various character sets
--enable-cgi # Enable CGI( Universal gateway interface ) Scripting support , It is convenient for the external expansion of the website and the application access ability
or
./configure --prefix=/usr/local/httpd --enable-so --enable-rewrite --enable-charset-lite --enable-cgi

Compilation and installation
[[email protected] httpd-2.4.29]# make -j3 && make install
# open 3 Kernel for compilation
Optimize the configuration file path , And put httpd The executable program file of the service is placed in the directory of the path environment variable for easy identification
ln -s /usr/local/httpd/conf/httpd.conf /etc/
ln -s /usr/local/httpd/bin/* /usr/local/bin/
add to httpd system service
cp /usr/local/httpd/bin/apachectl /etc/init.d/httpd # be used for service Service management
chmod +x /etc/init.d/httpd
vi /etc/init.d/httpd # Insert a new line after the first line , Add these three lines
# chkconfig: 35 85 21 #35 Level auto run The first 85 Start up The first 21 Closed
# description: Apache is a World Wide Web server
chkconfig --add httpd # take httpd Services added to service Manager
systemctl start httpd.service
or
service httpd start


modify httpd Service profile
vi /usr/local/httpd/conf/httpd.conf
#--52 That's ok -- modify
#Listen 20.0.0.59:80
--197 That's ok -- uncomment , modify
ServerName 20.0.0.59:80
--221 That's ok -- Default home page storage path
DocumentRoot "/usr/local/httpd/htdocs"
--255 That's ok -- Default home page file name setting
DirectoryIndex index.html
---》wq
# Check grammar
httpd -t or apachectl -t # Check whether the configuration items of the configuration file are wrong
cat /usr/local/httpd/htdocs/index.html
service httpd restart
netstat -anpt | grep 80


------------------------------ install MYSQL------------------------------------

Install environment dependency package
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
Storage engine options :
MYISAM,MERGE,MEMORY and cSv The engine is compiled to the server by default , There is no need to explicitly install . Statically compile a storage engine to the server , Use -DWITH engine STORAGE ENGINE= 1
The available storage engine values are :ARCHIVE,BLACKHOLE,EXAMPLE,FBDERATBD,IMNOBASB(InnoDB),PARTTTON(partitioning support), and PERFSCHEMA(Performance schema)
Compilation and installation
make -j 3 && make install
It takes a long time to wait ,-j 3 Represents compiling with two cores
Be careful : If in CMAKE There are errors in the process of , When the error is resolved , Need to put the source directory of CMakeCache.txt File deletion , And then... Again CMAKE, Otherwise, the mistake remains
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
sql_mode Common values are as follows :
NO_ENGINE_SUBSTITUTION
If the required storage engine is disabled or not compiled , Then throw an error . When this value is not set , Replace... With the default storage engine , And throw an exception
STRICT_TRANS_TABLES
In this mode , If a value cannot be inserted into a transaction table , Then interrupt the current operation , No restrictions on non transaction tables
NO_AUTO_CREATE_USER
Ban Zheng GRANT Create a user with a blank password
NO_AUTO_VALUE_ON_ZERO
mysql The self growing columns in can be derived from O Start . By default, self growing columns are generated from 1 At the beginning , If you insert a value of 0 The data will report an error
NO_ZERO_IN_DATE
Zero days and months are not allowed
NO_ZERO_DATE
mysql Database is not allowed to insert zero date , Inserting a zero date throws an error instead of a warning
ERROR_FOR_DIVISION_BY_ZERO
stay INSERT or UPDATE In the process , If the data is divided by zero , It's a mistake, not a warning . By default, when data is divided by zero MysQL return NULL
PIPES_As_CONCAT
take "||" Treat as the concatenation operator of a string, not as the or operator , This sum Oracle The database is the same , And string concatenation function Concat Similar
ANSI_QUOTES
Enable ANSI_QUOTES after , You can't use double quotes to refer to strings , Because it's interpreted as an identifier
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
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
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
cd /opt
tar zxvf php-7.1.24.tar.gz
cd /opt/php-7.1.24/
./configure \
--prefix=/usr/local/php7 \ # Specify the PHP The installation path of the program
--with-apxs2=/usr/local/httpd/bin/apxs \ # Appoint Apache httpd service-provided apxs The file location of the module support program
--with-mysql-sock=/usr/local/mysql/mysql.sock \ # Appoint mysql The storage path of the database connection file
--with-config-file-path=/usr/local/php7 # Set up PHP Configuration file for php.ini Where will it be stored
--with-mysqli \ # add to MySQL Extended support #mysqli Extension technology can not only call MySQL Stored procedure 、 Handle MySQL Business , It can also make the work of accessing database more stable
--with-zlib \ # Support zlib function , Provides data compression
--with-curl \ # Turn on curl Extend the functionality , Realization HTTP Of Get To download and Post Requested method
--with-gd \ # Activate gd Library support
--with-jpeg-dir \ # Activate jpeg Support for
--with-png-dir \ # Activate png Support for
--with-freetype-dir \
--with-openssl \
--enable-mbstring \ # Enable multi byte string function , In order to support Chinese and other codes
--enable-xml \ # Open the extensible markup language module
--enable-session \ # conversation
--enable-ftp \ # Text transfer protocol
--enable-pdo \ # function library
--enable-tokenizer \ # Token interpreter
--enable-zip #ZIP Compressed format
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/php7/php.ini
# Use... In the test environment php.ini-development file , And in the production environment php.ini-production file
vim /usr/local/php7/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/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
[PHP Modules]
Core
ctype
curl
date
dom
fileinfo
filter
ftp
gd
hash
iconv
json
libxml
mbstring
mysqli
mysqlnd
openssl
pcre
PDO
pdo_sqlite
Phar
posix
Reflection
session
SimpleXML
SPL
sqlite3
standard
tokenizer
xml
xmlreader
xmlwriter
zip
zlib
[Zend Modules]
modify httpd The configuration file for the service , Give Way apache Support PHP
vim /etc/httpd.conf
--392 That's ok -- Insert the following
AddType application/x-httpd-php .php
AddType application/x-httpd-php-source .phps
--256 That's ok -- Modify the first page file name settings
DirectoryIndex index.html index.php
---156 Row check support php7 Is there a module for ------
LoadModule php7_module modules/libphp7.so



verification PHP Test page
rm -rf /usr/local/httpd/htdocs/index.html
vim /usr/local/httpd/htdocs/index.php
<?php
phpinfo();
?>
systemctl restart httpd.service
Browser access
http://20.0.0.59


------------------------------ Install Forum ------------------------------
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;


Upload site update package
cd /opt/dis/dis_SC_UTF8/
# Upload site update package
cp -r upload/ /usr/local/httpd/htdocs/bbs

Change forum directory ownership
# Switch forum Directory
cd /usr/local/httpd/htdocs/bbs
# Change forum directory ownership (httpd If the installation configuration file is changed to apache, Then the following command will daemon Change it to apache, And create apache user )
chown -R daemon ./config
chown -R daemon ./data
chown -R daemon ./uc_client
chown -R daemon ./uc_server/data

Web input 20.0.0.59/bbs/install/, Verify whether you can log in





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 : admin123
Administrator account : admin
Administrator password : admin123


Register new users

[ Outside the chain picture transfer in ...(img-69lFqfwn-1658644707193)]
###### Web input 20.0.0.59/bbs/install/, Verify whether you can log in
[ Outside the chain picture transfer in ...(img-ZfcVIszL-1658644707193)]
[ Outside the chain picture transfer in ...(img-bm3sctZX-1658644707194)]
[ Outside the chain picture transfer in ...(img-HirRbKGX-1658644707194)]
[ Outside the chain picture transfer in ...(img-MOJQaHHY-1658644707194)]
[ Outside the chain picture transfer in ...(img-gmQwkhgO-1658644707194)]
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 : admin123
Administrator account : admin
Administrator password : admin123
[ Outside the chain picture transfer in ...(img-rIsGIhlK-1658644707195)]
[ Outside the chain picture transfer in ...(img-yIZpZzKg-1658644707195)]
###### Register new users
[ Outside the chain picture transfer in ...(img-fDqLqwLF-1658644707195)]

边栏推荐
- Code merging of centralized version control tools
- Mqtt---- bottom (precautions)
- Unity a user-friendly UI grayscale shader
- if 与 else if 的区别
- ESP8266-----SNTP获取网络时间
- 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
- 7. Formula F1 champion
- Longest common substring
- Question making notes 1
- ESP8266 AP_UDP_Server
猜你喜欢

ESP8266 STA_ UDP_ Client

MySQL关闭连接事务自动提交的问题

做题笔记1

Unity ugui text text box adaptation

Software Foundation of software test interview questions

Pit encountered by AssetBundle

4. Root user login

Unity CharacterController

Unity twitter login access

The MySQL character set is set to UTF-8, but the console still has the problem of Chinese garbled code
随机推荐
Linked list general OJ
十三、命令小工具
Unity twitter login access
MakeFile
Database interim (II)
数学建模简介-从现实对象到数学建模[2]
Pit encountered by AssetBundle
5. Xshell connection server denied access, password error
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
ESP8266 AP_TCP_Client
Unity 一个好用的UI灰度Shader
Unity 使用NavMesh实现简易的摇杆功能
十二、正则表达式
ESP8266 AP_UDP_Client
Navicat operation database 2 (micro advanced)
Some simple extension methods commonly used by unity
RS485 signal measurement
ESP8266 STA_ TCP_ Server
基本的DOS命令
matlab基本介绍[1]