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.
相关文章
|
3月前
|
安全 应用服务中间件 Linux
Debian操作系统如何安装Nginx并开启HTTP2
本指南介绍了在Linux系统中通过源码编译安装Nginx的完整流程。首先更新软件包列表并安装必要的编译依赖,接着下载指定版本的Nginx源码包(如1.24.0),检查文件完整性后解压。随后通过配置脚本指定安装路径与模块(如HTTP SSL模块),执行编译和安装命令。最后创建软链接以便全局调用,并提供启动、停止及重载Nginx的命令,同时提醒注意安全组设置以确保正常访问。
|
11月前
|
Ubuntu Linux iOS开发
问题./configure: error: the HTTP gzip module requires the zlib library.处理
问题./configure: error: the HTTP gzip module requires the zlib library.处理
1855 6
|
8月前
|
缓存 负载均衡 应用服务中间件
Nginx七层(应用层)反向代理:HTTP反向代理proxy_pass篇
通过使用Nginx的反向代理功能,可以有效地提高Web应用的性能、安全性和可扩展性。配置过程中需要注意不同场景下的具体需求,如负载均衡、SSL终止和缓存策略等。正确配置和优化Nginx反向代理可以显著提升系统的整体表现。
1301 20
|
9月前
|
数据采集 网络安全 Python
【Python】怎么解决:urllib.error.HTTPError: HTTP Error 403: Forbidden
解决 `urllib.error.HTTPError: HTTP Error 403: Forbidden`错误需要根据具体情况进行不同的尝试。通过检查URL、模拟浏览器请求、使用代理服务器和Cookies、减慢请求速度、使用随机的User-Agent以及使用更加方便的 `requests`库,可以有效解决此类问题。通过逐步分析和调试,可以找到最合适的解决方案。
614 18
|
9月前
|
应用服务中间件 Linux 网络安全
nginx安装部署ssl证书,同时支持http与https方式访问
为了使HTTP服务支持HTTPS访问,需生成并安装SSL证书,并确保Nginx支持SSL模块。首先,在`/usr/local/nginx`目录下生成RSA密钥、证书申请文件及自签名证书。接着,确认Nginx已安装SSL模块,若未安装则重新编译Nginx加入该模块。最后,编辑`nginx.conf`配置文件,启用并配置HTTPS服务器部分,指定证书路径和监听端口(如20000),保存后重启Nginx完成部署。
2947 8
|
9月前
|
数据采集 数据安全/隐私保护 Python
【Python】已解决:urllib.error.HTTPError: HTTP Error 403: Forbidden
通过上述方法,可以有效解决 `urllib.error.HTTPError: HTTP Error 403: Forbidden` 错误。具体选择哪种方法取决于服务器对请求的限制。通常情况下,添加用户代理和模拟浏览器请求是最常见且有效的解决方案。
574 10
|
11月前
|
网络协议 应用服务中间件 nginx
FFmpeg错误笔记(一):nginx-rtmp-module推流出现 Server error: Already publishing
这篇文章讨论了在使用nginx-rtmp-module进行RTMP推流时遇到的“Server error: Already publishing”错误,分析了错误原因,并提供了详细的解决办法,包括修改nginx配置文件和终止异常的TCP连接。
535 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 如何处理?
849 6
|
搜索推荐 Java 应用服务中间件
Nginx Rewrite 规则
【8月更文挑战第21天】Nginx Rewrite 规则
162 2
|
Web App开发 监控 UED
如何解决Angular中的Error: HTTP request failed, call timeout问题
在Angular应用中,遇到HTTP请求超时错误`Error: HTTP request failed, call timeout`时,可通过多种途径解决。首先,可增加请求超时时间,Angular默认无超时限制,设置合理的超时时间如5秒有助于避免长时间等待无响应。其次,检查服务器响应时间,利用开发者工具监控网络请求,优化服务器端代码或调整超时值。最后,确认网络连接稳定性,使用`navigator.onLine`检测网络状态,并在不同网络环境中测试。这些策略共同作用,能够有效提升应用的稳定性和用户体验。
664 1