nginx 编译错误 the HTTP gzip module requires the zlib library

Nginx 2020-07-24 阅读 95 评论 0

问题描述

下载 nginx 源代码,并安装,运行以下命令。

$ wget http://nginx.org/download/nginx-1.19.1.tar.gz
$ tar xf nginx-1.19.1.tar.gz
$ cd nginx-1.19.1
$ ./configure --prefix=/opt/nginx

但是最后报错了。

checking for zlib library ... not found

./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= option.

解决方法

需要安装 zlib-devel,可以手动安装或者命令行安装。

1. 手动安装

在 https://pkgs.org/search/?q=zlib 页面中,找到与操作系统相对应的 zlib-devel 版本,并下载安装。

2. 命令行安装

Ubuntu/Debian

sudo apt-get install zlib1g-dev

RHEL/CentOS

sudo yum install zlib-devel
最后更新 2020-08-13
MIP.watch('startSearch', function (newVal, oldVal) { if(newVal) { var keyword = MIP.getData('keyword'); console.log(keyword); // 替换当前历史记录,新增 MIP.viewer.open('/s/' + keyword, {replace: true}); setTimeout(function () { MIP.setData({startSearch: false}) }, 1000); } }); MIP.watch('goHome', function (newVal, oldVal) { MIP.viewer.open('/', {replace: false}); });