$ cd ~ $ wget http://nginx.org/download/nginx-1.12.0.tar.gz $ tar xf nginx-1.12.0.tar.gz $ cd nginx-
$ cd ~
$ wget http://nginx.org/download/nginx-1.12.0.tar.gz
$ tar xf nginx-1.12.0.tar.gz
$ cd nginx-1.12.0/
$ ./configure --user=www --group=www --prefix=/usr/local/nginx --with-http_stub_status_module --with-http_ssl_module --with-ipv6 --with-openssl=../openssl-1.1.0e --with-pcre=../pcre-8.40 --with-zlib=../zlib-1.2.11 --with-stream --with-stream_ssl_module
$ make
$ su
# cp -f objs/nginx /usr/local/nginx/sbin/
# chown www:www /usr/local/nginx/sbin/nginx
# systemctl restart nginx
# exit
$ cd ..
$ rm -fr nginx-1.12.0/
注:以上的openssl-1.1.0e/、pcre-8.40/、zlib-1.2.11/是相应的源码目录,与nginx-1.12.0/目录都在相同的父级目录下。
注意重启服务的命令:CentOS 7环境下systemctl restart nginx命令,CentOS 5.x, 6.x等低版本的使用service nginx restart
资源下载地址(点击标题可进入下载页面以方便选择下载其他版本):
1、openssl: https://www.openssl.org/source/openssl-1.1.0e.tar.gz
2、pcre: https://ftp.pcre.org/pub/pcre/pcre-8.40.tar.gz
3、zlib: http://zlib.net/zlib-1.2.11.tar.gz
4、nginx: http://nginx.org/download/nginx-1.12.0.tar.gz