Linux Installation and configuration of nginx
- 1, What is nginx
- 2, nginx installation
- 2.1 download from official website
- 2.2 download using wget command
- 2.3 unzip the installation package
- 2.4 configuration of nginx
- 2.5 compilation and installation
- 2.6 start and stop nginx
- 3, Installation command summary
Nginx (engine x) is a high performance HTTP and reverse proxy web server. It also provides IMAP/POP3/SMTP services. Nginx is the second most visited Russian by Igor sesoyev Rambler.ru The first public version 0.1.0 was released on October 4, 2004.
It publishes the source code in the form of BSD like license and is famous for its stability, rich feature set, sample configuration file and low consumption of system resources. nginx 1.0.4 was released on June 1, 2011.
Nginx is a lightweight Web server / reverse proxy server and email (IMAP/POP3) proxy server, which is distributed under BSD like protocol. Its characteristics are less memory and concurrent capability. In fact, nginx's concurrent capability is better in the same type of Web server. Chinese mainland users use Baidu website: Baidu, Jingdong, Sina, NetEase, Tencent, Taobao, etc.
Download address: Click to enter
After downloading, use the Xftp tool to put it into the remote server. Before that, it is recommended to create a nginx folder on the remote server to store the compressed files. The relevant codes are as follows:
Version can be downloaded according to their own needs, first go to the nginx official website to see what version, download.
wget -c https://nginx.org/download/nginx-1.19.0.tar.gz
tar -zxvf nginx-1.19.0.tar.gz
Unzip and enter the installation directory of nginx
Let's first add the dependency library.
(1) Install gcc environment
yum install gcc-c++
(2) Install PCRE dependency Library
yum install -y pcre pcre-devel
(3) Install zlib dependency Library
yum install -y zlib zlib-devel
(4) Install OpenSSL secure socket layer cipher Library
yum install -y openssl openssl-devel
Execute the configuration command:
./configure \ --prefix=/usr/local/nginx \ --conf-path=/usr/local/nginx/conf/nginx.conf \ --pid-path=/usr/local/nginx/conf/nginx.pid \ --lock-path=/var/lock/nginx.lock \ --error-log-path=/var/log/nginx/error.log \ --http-log-path=/var/log/nginx/access.log \ --with-http_gzip_static_module \ --http-client-body-temp-path=/var/temp/nginx/client \ --http-proxy-temp-path=/var/temp/nginx/proxy \ --http-fastcgi-temp-path=/var/temp/nginx/fastcgi \ --http-uwsgi-temp-path=/var/temp/nginx/uwsgi \ --http-scgi-temp-path=/var/temp/nginx/scgi
Note: to specify the temporary file directory as / var/temp/nginx, you need to create the temp and nginx directories under / var
Execute the order
Find installation path command:
Command to start and stop nginx
(1) Enter nginx directory first
(2) Execute the command again
./nginx open ./nginx -s stop stop it ./nginx -s quit ./nginx -s reload
. / nginx -s quit: the stop step in this mode is to stop after the nginx process has finished processing tasks.
. / nginx -s stop: this method is equivalent to first finding out the nginx process id, and then using the kill command to force killing the process.
wget -c https://nginx.org/download/nginx-1.19.0.tar.gz tar -zxvf nginx-1.19.0.tar.gz yum install gcc-c++ yum install -y pcre pcre-devel yum install -y zlib zlib-devel yum install -y openssl openssl-devel ./configure make install whereis nginx cd /usr/local/nginx/sbin/ ./nginx ./nginx -s stop ./nginx -s quit ./nginx -s reload
Reference link: https://blog.csdn.net/w410589502/article/details/70787468