Nginx官方上给出的configure参数是这样的
http://nginx.org/en/docs/configure.html
Example of parameters usage (all of this needs to be typed in one line):
./configure --sbin-path=/usr/local/nginx/nginx --conf-path=/usr/local/nginx/nginx.conf --pid-path=/usr/local/nginx/nginx.pid --with-http_ssl_module --with-pcre=../pcre-8.44 --with-zlib=../zlib-1.2.11
--with-zlib=../zlib-1.2.11
这一行参数指的是,指定zlib的源码路径,而不是编译安装后的路径
正确时做法是下载zlib-1.2.11.tar.gz,然后解压,不要安装,切记不要安装!
然后--with-zlib指明你解压后的zlib路径即可,nginx在执行make的时候,会自动到这个目录下去make
否则就会报错:
&& make libz.a
make[2]: Entering directory `/home/zlib'
make[2]: *** No rule to make target `distclean'. Stop.
make[2]: Leaving directory `/home/zlib'
make[1]: *** [/home/zlib/libz.a] Error 2
make[1]: Leaving directory `/home/rsm/nginx/nginx-1.16.1'
make: *** [build] Error 2