Ubuntu 21.4安装nginx源码编译./congigure时报错缺少zlib [./configure: error: the HTTP gzip module requires the zl

在Ubuntu 21.4上安装nginx时,通过源码编译遇到错误提示缺少zlib库。解决方法包括:1) 下载zlib源码,解压并配置、编译、安装;2) 使用apt-get命令安装依赖,包括pcre、gcc、zlib1g-dev和openssl。确保在配置nginx时添加--with-http_ssl_module选项。完成依赖安装后重新配置、编译和安装nginx。

Ubuntu 21.4安装nginx源码编译./congigure时报错缺少zlib ./configure: error: the HTTP gzip module requires the zlib library.

Ubuntu此时报错

./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依赖,安装即可

方法1

源码编译方法

  • 上官网下载
http://www.zlib.net/
  • 然后传到linux里面
  • 解压
tar -xvf 文件名


在这里插入图片描述

cd 文件夹名

在这里插入图片描述

  • 配置(configure)

  • 编译(make)

  • 安装(make install)

  • ./configure && make && make install
    

    使用&&连在一起运行

在这里插入图片描述


在这里插入图片描述


安装zlib完成

重新配置编译安装nginx

./configure && make && make install

碰到了另外一个问题,不过是别的帖子了

方法2

直接使用命令安装

安装pcre,gcc,zlib,g++,openssl依赖


pcre

apt-get install libpcre3 libpcre3-dev
gcc g++
apt-get install build-essential
apt-get install libtool
zlib
apt-get install zlib1g-dev
openssl
apt-get install openssl
apt-get install libssl-dev

再继续nginx的安装配置

不过要在./configure 后面加上参数配置https,加了这个参数https才能找到ssl模块

–with-http_ssl_module
 ./configure --prefix=/usr/local/nginx  --with-http_ssl_module

再make编译make install安装就不会在make报错了

评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值