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