当前位置:网站首页>LNMP compilation and installation
LNMP compilation and installation
2022-06-25 19:13:00 【Getting drunk and getting better】
Create package storage address
sudo mkdir /usr/local/software
1、Nginx install
Installation dependency
apt-get install gcc automake autoconf make
install gcc g++ The dependent libraries
sudo apt-get install build-essential
sudo apt-get install libtool
install pcre Dependency Library
sudo apt-get update
sudo apt-get install libpcre3 libpcre3-dev
install zlib Dependency Library
sudo apt-get install zlib1g-dev
install SSL Dependency Library
sudo apt-get install openssl
The formal installation nginx
cd /usr/local/software
# Download stable version
sudo wget http://nginx.org/download/nginx-1.14.2.tar.gz
# decompression
sudo tar -zxvf nginx-1.14.2.tar.gz
# cut-in Unpack the directory
cd /usr/local/software/nginx-1.14.2
# Be careful : To switch to root The user executes the configuration command
# To configure , This last nginx All installation files for , Including configuration files , Will be installed to /usr/local/nginx Directory
./configure --prefix=/usr/local/nginx
make && make install
start-up nginx And look at the process
sudo /usr/local/nginx/sbin/nginx -c /usr/local/nginx/conf/nginx.conf
# Be careful :-c Specify the path of the configuration file , If not ,nginx The configuration file for the default path will be loaded automatically , Can pass -h View help command .
# Check the process :
ps -ef | grep nginx
Check the port
netstat -lntp
Configure boot up
sudo vim /etc/rc.local
# Add the following code
/usr/local/nginx/sbin/nginx -c /usr/local/nginx/conf/nginx.conf &
Add environment variables ( Others are separated by colons )
sudo vim /etc/profile
# Join in nginx route
export PATH=$PATH:/usr/local/nginx/sbin
install php (php 7.2)
Installation dependency
apt-get install libxml2-dev gcc autoconf
Get the source code and compile and install
Upload directly from local php Source code , perhaps wget Get online resources
sudo mkdir /usr/local/php
cd /usr/local/software
# Switch to root user Perform the following actions
wget https://www.php.net/distributions/php-7.2.16.tar.gz
tar -zxvf php-7.2.16.tar.gz
cd php-7.2.16
# Installation dependency
sudo apt update
sudo apt install gcc
sudo apt install make
sudo apt install openssl
sudo apt install curl
sudo apt install libbz2-dev
sudo apt install libxml2-dev
sudo apt install libjpeg-dev
sudo apt install libpng-dev
sudo apt install libfreetype6-dev
sudo apt install libzip-dev
sudo apt install libssl-dev
precompile
./configure --prefix=/usr/local/php --with-config-file-path=/usr/local/php/etc --enable-fpm --with-fpm-user=www --with-fpm-group=www --with-mysqli --with-pdo-mysql --with-iconv-dir --with-freetype-dir --with-jpeg-dir --with-png-dir --with-zlib --with-libxml-dir=/usr --enable-xml --disable-rpath --enable-bcmath --enable-shmop --enable-sysvsem --enable-inline-optimization --with-curl-dir=/usr/bin/curl --enable-mbregex --enable-mbstring --enable-ftp --with-gd --with-openssl --with-mhash --enable-pcntl --enable-sockets --with-xmlrpc --enable-zip --enable-soap --without-pear --with-gettext --disable-fileinfo --enable-maintainer-zts
Until you see this interface , Precompile successful 
Compile and install , Parameters -j Specify the number of compilation threads for multi-threaded compilation
sudo make -j4
See this to complete the compilation 
Execute the following command to install
sudo make install
After the installation is completed, enter the command to view the version
/usr/local/php/bin/php -v
Successfully compiled and installed from source code .
Finally, copy a configuration file compiled from the source code
sudo cp php.ini-development /usr/local/php/etc/php.ini
To configure php-fpm command :
cd /usr/local/php/etc cp php-fpm.conf.default php-fpm.conf
cd php-fpm.d cp www.conf.default www.conf
groupadd www
useradd -g www www
start-up
/usr/local/php/sbin/php-fpm
verification
ps -ef |grep php-fpm
Nginx analysis PHP Multisite configuration
cd /usr/local/nginx/conf
Edit the configuration file to multiple files
vim nginx.conf
hold nginx.conf Inside server{} Comment out in , Then import the following files 
New folder
mkdir vhosts
cd vhosts/
New configuration file , It is recommended that the file name be recognized , One file, one site
vim 1.com.conf
Profile contents
server {
listen 8080; # Listening port
server_name 127.0.0.1; # Site domain name
root /home/wwwroot/test/public; # Site root
index index.html index.htm index.php default.html default.htm default.php; # The default navigation page
location / {
if (!-e $request_filename) {
rewrite ^(.+?\.php)(/.+)$ /$1?s=$2 last;
rewrite ^(.*)$ /index.php?s=$1 last;
break;
}
}
# PHP To configure
location ~ ^(.+.php)(.*)$ {
fastcgi_split_path_info ^(.+.php)(.*)$;
include fastcgi.conf;
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
fastcgi_param PATH_INFO $fastcgi_path_info;
}
location ~* ^.+\.(ico|gif|jpg|jpeg|png)$ {
access_log off;
root /home/wwwroot/test/public;
expires 7d;
}
}
restart
cd /usr/local/nginx
./sbin/nginx -s reload
Successful visit
Configure boot up
sudo vim /etc/rc.local
# Add code
/usr/local/php/sbin/php-fpm &
Add environment variables
sudo vim /etc/profile
# Join in nginx route
export PATH=$PATH:/usr/local/nginx/sbin:/usr/local/php/bin
mysql install
Installation dependency ( If you compile and install ) Be careful : MySQL8.0 Need to use gcc The version is 5.3 above
sudo apt install gcc g++ libxml2 libxml2-dev libssl-dev curl libcurl4-openssl-dev libgd-dev
sudo apt install numactl
sudo apt install libaio-dev
sudo apt install cmake
Download binaries Unzip and move
sudo wget https://dev.mysql.com/get/Downloads/MySQL-8.0/mysql-8.0.15-linux-glibc2.12-x86_64.tar.xz
sudo xz -d mysql-8.0.15-linux-glibc2.12-x86_64.tar.xz
sudo tar xvf mysql-8.0.15-linux-glibc2.12-x86_64.tar
sudo mv mysql-8.0.15-linux-glibc2.12-x86_64 /usr/local/mysql
add to mysql Users and groups and grant permissions
groupadd mysql
useradd -r -g mysql -s /bin/false mysql
cd /usr/local/mysql
mkdir mysql-files
chown mysql:mysql mysql-files
chmod 750 mysql-files
sudo passwd mysql
Initialization operation
sudo bin/mysqld --initialize --user=mysql
After implementation, it is as follows : ( The second line The last part is Randomly generated passwords )
2022-02-13T12:53:04.809140Z 0 [System] [MY-013169] [Server] /usr/local/mysql/bin/mysqld (mysqld 8.0.15) initializing of server in progress as process 7638
2022-02-13T12:53:07.799894Z 5 [Note] [MY-010454] [Server] A temporary password is generated for [email protected]localhost: laBnPPN)3dIh
2022-02-13T12:53:09.210107Z 0 [System] [MY-013170] [Server] /usr/local/mysql/bin/mysqld (mysqld 8.0.15) initializing of server has completed
Copy service file
cp support-files/mysql.server /etc/init.d/mysql.server
Configure boot service
sudo vim /etc/rc.local
# increase mysql Open command
/usr/local/mysql/bin/mysqld_safe --user=mysql &
Add environment variables
sudo vim /etc/profile
# Add the following path
/usr/local/mysql/bin
# Update variables and take effect
source /etc/profile
Turn on mysql The server
bin/mysqld_safe --user=mysql &
Log in with the password you just recorded
bin/mysql -uroot -p
modify root password
ALTER USER 'root'@'localhost' IDENTIFIED WITH mysql_native_password BY '123456'
边栏推荐
- mysql视图讲解
- Current situation and development suggestions of China's green PPP project industry: the investment scale is expanding, and the existing problems need to be improved to further promote the healthy dev
- Analysis on planting area, output and import of sugarcane in Guangxi in 2021: the output of sugarcane in Guangxi accounts for 68.56% of the total output of sugarcane in China [figure]
- QQ robot flash forwarding / recall message forwarding [latest beta2 version]
- electron 基础项目搭建 &&主线程和渲染线程的通信
- Connecting PHP to MySQL instances in the lamp environment of alicloud's liunx system
- QQ robot official plug-in loading configuration method [beta2 version]
- 3、 Hikaricp source code analysis of connection acquisition process III
- Tcp/ip test questions (III)
- Tcp/ip test questions (II)
猜你喜欢

Can GoogleSEO only do content without external chain? (e6zzseo)

Huawei released two promotion plans to promote AI talent development and scientific research innovation

Genicam gentl standard ver1.5 (1)

Guangzhou Sinovel interactive creates VR Exhibition Hall panoramic online virtual exhibition hall
![Current situation and trend analysis of China's glass packaging containers in 2021: the revenue of glass packaging containers increases year by year [figure]](/img/19/d93c8647415c593de9c3c959f72d64.jpg)
Current situation and trend analysis of China's glass packaging containers in 2021: the revenue of glass packaging containers increases year by year [figure]
Android Development Notes - Quick Start (from sqllite to room licentiousness) 2

ECS 7-day practical training camp (Advanced route) -- day04 -- build a portal using ECs and polardb
![Analysis on development status and development suggestions of e-commerce industry in Xinjiang in 2020 [figure]](/img/d1/8ed2958ef365e17494bade6e29ee04.jpg)
Analysis on development status and development suggestions of e-commerce industry in Xinjiang in 2020 [figure]
![In 2021, China's private equity market is growing, and the scale of private equity fund management reaches 19.78 trillion yuan [figure]](/img/e9/ffc5303cb6f0f8e05e93b3342a49b2.jpg)
In 2021, China's private equity market is growing, and the scale of private equity fund management reaches 19.78 trillion yuan [figure]

Sorting out the latest data mining competition scheme!
随机推荐
Divine reversion EA
QQ机器人疫情查询/疫情关注等【最新beta2版本】
JVM|运行时数据区(堆空间)
Genicam gentl standard ver1.5 (1)
mysql my. Understanding CNF depends on configuration
六、HikariConfig的配置解析
JS some small problems about adding and accessing values to arrays
Elastic high-performance computing on the cloud supports the rapid development of the life science industry, reducing costs and increasing efficiency
In 2021, China's private equity market is growing, and the scale of private equity fund management reaches 19.78 trillion yuan [figure]
Redis cache preheating & avalanche & breakdown & penetration
Ali vision AI training camp-day01
Server journey from scratch - Yu Zhongxian integrated version (IP access server, LNMP compilation and installation, Lua environment and socket expansion)
QQ机器人:群成员自我禁言管理【最新beta2版本】
Solidity contract address to wallet, wallet address to contract
JVM | runtime data area (heap space)
Why are life science enterprises on the cloud in succession?
TCP/IP 测试题(二)
Network security detection and prevention test questions (V)
Tcp/ip test questions (II)
Analysis on planting area, output and import of sugarcane in Guangxi in 2021: the output of sugarcane in Guangxi accounts for 68.56% of the total output of sugarcane in China [figure]