nginx configure error the HTTP gzip module requires the zlib library
Issue
Download the nginx source code and configure, run the following commands.
$ 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
But I get the error message saying:
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.
Solution
It requires zlib-devel
package.
1.Install manually
On the web page https://pkgs.org/search/?q=zlib, find the zlib-devel
version that matches your operating system, and download and install it.
2. With command line
Ubuntu/Debian
sudo apt-get install zlib1g-dev
RHEL/CentOS
sudo yum install zlib-devel