3分钟教你搞定 nginx 编译安装报错:error: the HTTP rewrite module requires the PCRE library.

简介: 3分钟教你搞定 nginx 编译安装报错:error: the HTTP rewrite module requires the PCRE library.

nginx 编译安装报错error: the HTTP rewrite module requires the PCRE library.



前言


今天小编在给大家分享如何编译安装nginx 。编译安装其实不难,我们只需知道去哪里下载安装包。然后解压安装包,进行编译


源码安装 ”三把斧“。


1.configure --user=xx --prefix=安装路径 --help 可以查看先关参数


2.make


3.make install


对于初学者来说,它难在 它需要很多库文件,如果系统没有,编译就无法进行。今天我就nginx 安装,分析它常见的安装错误


问题描述


  • 编译报错


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


image.png


遇到编译报错,一般都是缺少库文件或者其它文件。我们根据它提示的内容多次进行编译,安装先关文件


最终安装成功!


源码编译安装初次觉得难,多安装几次就变简单了


问题原因


  • 缺少安装包,根据提示一步步安装


解决办法


  • yum 安装 pcre


# yum 安装prce library
[root@web_server01/usr/src/nginx-1.20.1]# yum -y install pcre


  • 根据提示安装模块


image.png


# 根据提示:尾部添加 --without-http_rewrite_module
[root@web_server01/usr/src/nginx-1.20.1]# ./configure --user=nginx --prefix=/usr/local/nginx --with-http_ssl_module --with-http_realip_module --with-http_image_filter_module --with-http_gunzip_module --with-http_gzip_static_module --with-http_stub_status_module --http-log-path=/var/log/nginx/access.log --error-log-path=/var/log/nginx/error.log --without-http_rewrite_module


  • 再次编译报错:


image.png


  • 安装openssl openssl-devel


[root@web_server01/opt]# yum -y install openssl openssl-devel


  • 再次编译报错:


image.png


  • 安装gd-devel


# 安装gd-devel
[root@web_server01/usr/src/nginx-1.20.1]# yum -y install gd-devel


总结



== 安装提示==


很重要,我们要根据安装提示进行安装相关文件


如果你不知道文件全称叫啥,还可以通过关键字加*


例如:yum -y install openssl*


  • nginx 安装需要安装的环境依赖:


  • yum -y install pcre-devel openssl openssl-devel gd-devel gcc gcc-c++


  • 常见报错提示


./configure: error: SSL modules require the OpenSSL library.
You can either do not enable the modules, or install the OpenSSL library
into the system, or build the OpenSSL library statically from the source
with nginx by using --with-openssl=<path> option.
./configure: error: the HTTP image filter module requires the GD library.
You can either do not enable the module or install the libraries.
相关文章
|
缓存 应用服务中间件 网络安全
Nginx中配置HTTP2协议的方法
Nginx中配置HTTP2协议的方法
1564 7
|
Ubuntu Linux iOS开发
问题./configure: error: the HTTP gzip module requires the zlib library.处理
问题./configure: error: the HTTP gzip module requires the zlib library.处理
2804 6
|
数据可视化 关系型数据库 MySQL
ELK实现nginx、mysql、http的日志可视化实验
通过本文的步骤,你可以成功配置ELK(Elasticsearch, Logstash, Kibana)来实现nginx、mysql和http日志的可视化。通过Kibana,你可以直观地查看和分析日志数据,从而更好地监控和管理系统。希望这些步骤能帮助你在实际项目中有效地利用ELK来处理日志数据。
1087 90
|
监控 Unix 应用服务中间件
Android-音视频学习系列-(八)基于-Nginx-搭建(rtmp、http)直播服务器
Android-音视频学习系列-(八)基于-Nginx-搭建(rtmp、http)直播服务器
|
关系型数据库 MySQL PHP
源码编译安装LAMP(HTTP服务,MYSQL ,PHP,以及bbs论坛)
通过以上步骤,你可以成功地在一台Linux服务器上从源码编译并安装LAMP环境,并配置一个BBS论坛(Discuz!)。这些步骤涵盖了从安装依赖、下载源代码、配置编译到安装完成的所有细节。每个命令的解释确保了过程的透明度,使即使是非专业人士也能够理解整个流程。
620 18
|
缓存 负载均衡 应用服务中间件
Nginx七层(应用层)反向代理:HTTP反向代理proxy_pass篇
通过使用Nginx的反向代理功能,可以有效地提高Web应用的性能、安全性和可扩展性。配置过程中需要注意不同场景下的具体需求,如负载均衡、SSL终止和缓存策略等。正确配置和优化Nginx反向代理可以显著提升系统的整体表现。
2673 20
|
应用服务中间件 Linux 网络安全
nginx安装部署ssl证书,同时支持http与https方式访问
为了使HTTP服务支持HTTPS访问,需生成并安装SSL证书,并确保Nginx支持SSL模块。首先,在`/usr/local/nginx`目录下生成RSA密钥、证书申请文件及自签名证书。接着,确认Nginx已安装SSL模块,若未安装则重新编译Nginx加入该模块。最后,编辑`nginx.conf`配置文件,启用并配置HTTPS服务器部分,指定证书路径和监听端口(如20000),保存后重启Nginx完成部署。
5765 8
|
网络协议 应用服务中间件 nginx
FFmpeg错误笔记(一):nginx-rtmp-module推流出现 Server error: Already publishing
这篇文章讨论了在使用nginx-rtmp-module进行RTMP推流时遇到的“Server error: Already publishing”错误,分析了错误原因,并提供了详细的解决办法,包括修改nginx配置文件和终止异常的TCP连接。
911 0
FFmpeg错误笔记(一):nginx-rtmp-module推流出现 Server error: Already publishing
|
应用服务中间件 nginx
nginx error日志 client intended to send too large body: 1434541 bytes 如何处理?
【8月更文挑战第27天】nginx error日志 client intended to send too large body: 1434541 bytes 如何处理?
1230 6
|
应用服务中间件 nginx
[nginx]编译安装openresty
[nginx]编译安装openresty
1601 6

热门文章

最新文章