Reference https://www.cnblogs.com/liujuncm5/p/6713784.html
Nginx is a C-language development
A gcc installed
install nginx need to first official website to download the source code to compile, gcc compiler-dependent environment, if there is no gcc environment, you need to install:
yum install gcc-c++
Two. PCRE pcre-devel installed
PCRE (Perl Compatible Regular Expressions) is a Perl library, including perl-compatible regular expression library. The module uses nginx http pcre regular expressions to parse, so it is necessary to install pcre library on linux, pcre-devel pcre developed using a secondary development library. nginx also need this library. command:
yum install -y pcre pcre-devel
Three. Zlib install
zlib library provides a variety of compression and decompression of the way, nginx using zlib the contents of the package are http gzip, so you need to install on Centos zlib library.
yum install -y zlib zlib-devel
Four. OpenSSL installed
OpenSSL is a powerful Secure Sockets Layer cryptographic libraries include major cryptographic algorithms commonly used key and certificate management and SSL protocol encapsulation, and provides a wealth of applications for testing or other purposes.
nginx not only supports the http protocol, also supports https (http over ssl ie transmission protocol), so you need to install the OpenSSL library in Centos.
yum install -y openssl openssl-devel
Use wget
command to download Nginx (no need to install wget about yum -y install wget) version can choose
wget -c https://nginx.org/download/nginx-1.12.0.tar.gz
Or download through the official website
1. Download .tar.gz
the installation package, Address: https://nginx.org/en/download.html
Decompression
tar -zxvf nginx-1.12.0.tar.gz cd nginx-1.12.0
Configuration
In fact, nginx-1.12.0 version you do not need to configure the relevant things, the default on it. Of course, if you want your own configuration directory is also possible.
1. Use the default configuration
./configure
Note: The temporary file directory as / var / temp / nginx, and nginx need to create a temp directory in / var
Compile and install
make
make install
Finding the installation path:
whereis nginx
Command to start, stop, and so on. . . .
./ nginx - start . / Nginx - S STOP - Stop ./nginx -s quit ./nginx -s reload
View is running
ps -A | grep nginx
If you have to return the proof is on
Last Seen port is generally the default path in the configuration file by /usr/local/nginx/conf/nginx.conf
Detailed specific configuration file can Baidu