1. 程式人生 > >Nginx編譯安裝錯誤error: the HTTP gzip module requires the zlib library

Nginx編譯安裝錯誤error: the HTTP gzip module requires the zlib library

在nginx中我們執行“./configure” 會提示 error: the HTTP gzip module requires the zlib library意思是告訴我們沒有zlib library的支援了 碰到此類問題我們只要安裝這個庫就可以了。
下載後,解包,並進入nginx

 
tar -zxf nginx-1.4.7.tar.gz
cd nginx-1.4.7
 
開始nginx安裝:
 
./configure
make
make install
 
若在“./configure”後方加入了“--with-http_gzip_static_module”(新增gzip壓縮模組)提示以下錯誤:

./configure: error: the HTTP gzip module requires the zlib library.
You can either disable the module by using –without-http_gzip_module
option, or install the zlib library into the system, or build the zlib 
library
statically from the source with nginx by using –with-zlib=<path> option.

則需要安裝“zlib-devel”即可。SSH執行以下命令:

 程式碼如下 複製程式碼

yum install -y zlib-devel

然後再進行nginx的編譯。表示問題即可解決。

像還有一些其它元件錯誤如:

You need a C++ compiler for C++ support

缺少c++編譯器的原因


yum install -y gcc gcc-c++

make[1]: *** [/usr/local/pcre/Makefile] Error 127.pcre指向錯誤

指向原始碼包,不是編譯安裝後的包,所以

./configure –prefix=/export/lnmp/nginx-1.4.7 –with-pcre=../pcre-8.34

好了我在使用nginx編譯安裝時碰到幾大問題都總結了一下,希望能幫助到各位。