download link:
http://nginx.org/en/download.html
Install dependencies
yum install -y gcc gcc-c++ zlib zlib-devel pcre-devel openssl openssl-devel
Compile and install
./configure --prefix=/usr/local/nginx-1.12.2 --with-http_ssl_module --with-pcre
make
make instll
$ nginx -v
bash: nginx: command not found
add environment variable
$ vim /etc/profile
export PATH=$PATH:/usr/local/nginx-1.12.2/sbin
Configuration takes effect
$ source /etc/profile
start up
$ /usr/local/nginx-1.12.2/sbin/nginx