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

170

被折叠的 条评论
为什么被折叠?



