1、问题
在ubuntu系统下,使用./configure --prefix=/usr/local/nginx 安装nginx时候,报错:
./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.
2、解决
(1)在ubuntu软件源里zlib和zlib-devel分别叫做zlib1g 和zlib1g.dev
sudo apt-get install zlib1g
sudo apt-get install zlib1g.dev(使用这个命令进行安装后,会报错)
(2)先安装ruby
sudo apt-get install ruby
(3)然后再使用命令sudo apt-get install zlib1g.dev进行安装,有的系统还会报错,主要是依赖的错误。
选择对应的依赖项重新安装一次,比如
sudo apt-get install zlib1g=1:1.2.8.dfsg-1ubuntu1.1.
然后安装zlib1g.dev,sudo apt-get install zlib1g.dev
(4)最后运行./configure脚本
成功如下:
安装:
make &&make install