【踩坑】Nginx编译时报错

前言

Nginx编译时报错

报错

  • 报错:./configure: error: the HTTP XSLT module requires the libxml2/libxslt libraries. You can either do not enable the module or install the libraries.

解决问题

CentOS

1
2
yum install -y libxslt libxslt-devel
yum install -y libxml2 libxml2-devel

Debian

1
2
apt install -y libxslt libxslt-dev
apt install -y libxml2 libxml2-dev

报错

  • 报错:./configure: error: the HTTP image filter module requires the GD library. You can either do not enable the module or install the libraries.

解决问题

CentOS

1
yum install -y gd gd-devel

Ubuntu

1
yum install -y gd gd-dev

报错

  • 报错:./configure: error: perl module ExtUtils::Embed is required

解决问题

CentOS

1
yum -y install perl-ExtUtils-Embed

报错

  • 报错:./configure: error: the Google perftools module requires the Google perftools library. You can either do not enable the module or install the library.

解决问题

1
yum install –y gperftools

报错

  • 报错:./configure: error: the GeoIP module requires the GeoIP library. You can either do not enable the module or install the library.

解决问题

CentOS

1
yum install -y GeoIP GeoIP-devel
Ubuntu
1
yum install -y GeoIP GeoIP-dev

报错

  • 报错:./configure: error: the HTTP rewrite module requires the PCRE library. You can either disable the module by using --without-http_rewrite_module option, or install the PCRE library into the system, or build the PCRE library statically from the source with nginx by using --with-pcre=<path> option.

解决问题

CentOS

1
yum install -y libpcre3 libpcre3-devel

Debian

1
apt install -y libpcre3 libpcre3-dev

报错

  • 报错:cc1: all warnings being treated as errors

解决问题

  • 删除nginx/objs/Makefile配置文件中的所有-Werror关键词

完成

参考文献

CSDN——Mintimate
CSDN——小白正在飞
CSDN——Blau
CSDN——爱辉弟啦
腾讯云开发者社区——stark张宇
CSDN——Blau
稀土掘金——JudithHuang