nginx安装时报错 ./configure: error:You can either disable the module by using --without-http_gzip_module

本文介绍在Ubuntu系统中安装Nginx时遇到的HTTP gzip模块错误,并提供详细的解决方案,包括正确安装zlib库的方法及步骤。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

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

 

 

 

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值