yum install -y pcre-devel zlib-devel openssl-devel wget gcc tree vim
wget http://nginx.org/download/nginx-1.12.2.tar.gz
[root@localhost ~]# cd nginx/
[root@localhost nginx]#./configure --prefix=/usr/local/nginx
[root@localhost nginx]#make && make install
export PATH=$PATH:/usr/local/nginx/sbin
[root@localhost ~]# source ./.bash_profile
[root@localhost ~]# nginx
[root@localhost ~]# nginx -s stop
原文:https://www.cnblogs.com/cplinux/p/10864489.html