1、下载安装包:
wget https://nginx.org/download/nginx-1.17.3.tar.gz
2、解压:
tar xvfz nginx-1.17.3.tar.gz
cd nginx-1.17.3
3、编译:
./configure --prefix=/usr/local/nginx
make
make install
如果编译失败:./configure: error: the HTTP rewrite module requires the PCRE library.You can either disable the module by using--without-http_rewrite_moduleoption, orinstallthe PCRElibraryintothesystem,orbuildthe PCRElibrarystaticallyfromthesourcewithnginxbyusing--with-pcre=<path> option.
①、需要安装pcre包:https://ftp.pcre.org/pub/pcre/
②、tar zxvf pcre-8.12.tar.gz
③、cd pcre-8.12
④、./configure
⑤、make
⑥、make install
4、查看是否安装成功:
/usr/local/nginx/sbin/nginx -t
