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.
相关文章
|
Ubuntu Linux iOS开发
问题./configure: error: the HTTP gzip module requires the zlib library.处理
问题./configure: error: the HTTP gzip module requires the zlib library.处理
1894 6
|
7月前
|
关系型数据库 MySQL PHP
源码编译安装LAMP(HTTP服务,MYSQL ,PHP,以及bbs论坛)
通过以上步骤,你可以成功地在一台Linux服务器上从源码编译并安装LAMP环境,并配置一个BBS论坛(Discuz!)。这些步骤涵盖了从安装依赖、下载源代码、配置编译到安装完成的所有细节。每个命令的解释确保了过程的透明度,使即使是非专业人士也能够理解整个流程。
153 18
|
10月前
|
数据采集 网络安全 Python
【Python】怎么解决:urllib.error.HTTPError: HTTP Error 403: Forbidden
解决 `urllib.error.HTTPError: HTTP Error 403: Forbidden`错误需要根据具体情况进行不同的尝试。通过检查URL、模拟浏览器请求、使用代理服务器和Cookies、减慢请求速度、使用随机的User-Agent以及使用更加方便的 `requests`库,可以有效解决此类问题。通过逐步分析和调试,可以找到最合适的解决方案。
640 18
|
10月前
|
数据采集 数据安全/隐私保护 Python
【Python】已解决:urllib.error.HTTPError: HTTP Error 403: Forbidden
通过上述方法,可以有效解决 `urllib.error.HTTPError: HTTP Error 403: Forbidden` 错误。具体选择哪种方法取决于服务器对请求的限制。通常情况下,添加用户代理和模拟浏览器请求是最常见且有效的解决方案。
601 10
|
12月前
|
网络协议 应用服务中间件 nginx
FFmpeg错误笔记(一):nginx-rtmp-module推流出现 Server error: Already publishing
这篇文章讨论了在使用nginx-rtmp-module进行RTMP推流时遇到的“Server error: Already publishing”错误,分析了错误原因,并提供了详细的解决办法,包括修改nginx配置文件和终止异常的TCP连接。
555 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 如何处理?
876 6
|
Web App开发 监控 UED
如何解决Angular中的Error: HTTP request failed, call timeout问题
在Angular应用中,遇到HTTP请求超时错误`Error: HTTP request failed, call timeout`时,可通过多种途径解决。首先,可增加请求超时时间,Angular默认无超时限制,设置合理的超时时间如5秒有助于避免长时间等待无响应。其次,检查服务器响应时间,利用开发者工具监控网络请求,优化服务器端代码或调整超时值。最后,确认网络连接稳定性,使用`navigator.onLine`检测网络状态,并在不同网络环境中测试。这些策略共同作用,能够有效提升应用的稳定性和用户体验。
685 1
|
应用服务中间件 nginx
[nginx]编译安装openresty
[nginx]编译安装openresty
383 6
|
传感器 机器学习/深度学习
如何下载DVS Gesture数据集?解决tonic.datasets.DVSGesture错误HTTP Error 403: Forbidden
本文介绍了如何解决在使用tonic库下载DVSGesture数据集时遇到的HTTP Error 403 Forbidden错误,建议从Figshare的链接下载完整数据集并解压到指定目录,以便成功加载数据集进行手势识别研究。
362 1
|
API Python
【Python】已解决:urllib.error.HTTPError: HTTP Error 403: Forbidden
【Python】已解决:urllib.error.HTTPError: HTTP Error 403: Forbidden
3543 2