Nginx download and install

Time:2020-9-25

Environmental Science

System environment: CentOS 7.7
Nginx:nginx/1.17.9

1. Introduction to nginx

Nginx 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 Site developed,, is known for its stability, rich feature set, sample configuration files, and low system resource consumption.

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 concurrency capability is better in the same type of web server. Users in mainland China using Nginx website include Baidu, Jingdong, Sina, NetEase, Tencent, Taobao, etc.

2. Download

Download from the official website, search nginx with Baidu search engine of the world’s top 500 technology enterprises, and currently select the latest version of nginx-1.17.9 tar.gz
The steps are as follows:
Nginx download and install
Nginx download and install
Nginx download and install

3. Installation

3.1. Installation dependency

[[email protected] ]# yum -y install gcc pcre-devel zlib-devel openssl openssl-devel

3.2. Upload and unzip

You can download nginx-1.17.9 through winscp tar.gz Upload to the server and directory, and then unzip

[[email protected] /]# tar -zxvf nginx-1.17.9.tar.gz 

3.3. Compilation and installation

[[email protected] /]# cd nginx-1.17.9
[[email protected] nginx-1.17.9]# ./configure
[[email protected] nginx-1.17.9]# make && make install

The default installation location is:

[[email protected] nginx]# pwd
/usr/local/nginx

Service startup:

[[email protected] nginx]# /usr/local/nginx/sbin/nginx 
[[email protected] nginx]# ps -ef | grep nginx
root      39801      1  0 15:20 ?        00:00:00 nginx: master process /usr/local/nginx/sbin/nginx
nobody    39802  39801  0 15:20 ?        00:00:00 nginx: worker process
root      39804  37153  0 15:20 pts/0    00:00:00 grep --color=auto nginx

Now it’s up, but most ports of Linux firewall are not open by default. Now it needs to be opened. Nginx port 80 (default)

#View firewall status
[[email protected] nginx]# firewall-cmd --state
running
#Release port 80, (-- permanent takes effect permanently, and fails after restart without this parameter)
[[email protected] nginx]# firewall-cmd --zone=public --add-port=80/tcp --permanent
success
#Reload firewall information
[[email protected] nginx]# firewall-cmd --reload
success

The following figure shows that the installation of nginx service is successful
Nginx download and install
###3.4 nginx common commands

[[email protected] sbin]# pwd
/usr/local/nginx/sbin
#View nginx version
[[email protected] sbin]# ./nginx -V
nginx version: nginx/1.17.9
built by gcc 4.8.5 20150623 (Red Hat 4.8.5-39) (GCC) 
configure arguments:
#Close nginx 
[[email protected] sbin]# ./nginx -s stop
#Open nginx 
[[email protected] sbin]# ./nginx
#Reload nginx configuration
[[email protected] sbin]# ./nginx -s reload
#Nginx configuration file
[[email protected] sbin]# vi /usr/local/nginx/conf/nginx.conf

More configuration in nginx.conf Nginx can also deploy distributed file systems with fastdfs. More functions are being tried

If there is something wrong, please identify it and thank you in advance