当前位置: 首页 > news >正文

【总结】nginx源码编译安装报错./configure: error: SSL modules require the OpenSSL library.

问题现象

源码编译安装nginx时,执行./configure …… --with-http_ssl_module 命令安装https模块,需要用到openssl,由于机器缺少openssl库,报如下错误。

……
checking for openat(), fstatat() ... found
checking for getaddrinfo() ... found
checking for PCRE2 library ... not found
checking for PCRE library ... found
checking for PCRE JIT support ... found
checking for OpenSSL library ... not found
checking for OpenSSL library in /usr/local/ ... not found
checking for OpenSSL library in /usr/pkg/ ... not found
checking for OpenSSL library in /opt/local/ ... not found./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.

排查分析

因为机器不能连接外网,采用离线安装rpm 包的方式,安装openssl
从网上下载了:
openssl-1.0.2k-26.el7_9.x86_64.rpm
openssl-devel-1.0.2k-26.el7_9.x86_64.rpm

使用以下命令安装:
sudo rpm -ivh openssl-1.0.2k-26.el7_9.x86_64.rpm --nodeps --force
sudo rpm -ivh openssl-devel-1.0.2k-26.el7_9.x86_64.rpm --nodeps --force

openssl安装后,openssl命令正常。但是执行./configure …… --with-http_ssl_module 还是报一样的错误。

在网上搜罗了一堆方法,改各种文件,都没有生效。

此时,严重怀疑是使用rpm 离线安装openssl库时,由于使用了–nodeps --force 这两个指令,忽略了openssl的依赖库,强制安装。导致openssl某些依赖,没有安装成功,从而导致openssl不可用。

于是再次认真阅读提示信息: or build the OpenSSL library statically from the source with nginx by using --with-openssl= option.

那就尝试一下吧,使用openssl源码静态库的方式来编译nginx。

解决方法

从openssl官网下载源码,使用–with-openssl= 的方式来编译安装。
下载地址:https://www.openssl.org/source/old/index.html

本人使用的centos 7,下载的是1.1.0k这个版本。
在这里插入图片描述
下载后解压,假如此处解压的目录是:/data/openssl-1.1.0k
那么执行:./configure --prefix=/data/nginx --with-http_stub_status_module --with-http_ssl_module --with-openssl=/data/openssl-1.1.0k
以上命令,可顺利通过。

接下来,执行:make && make install 就顺利编译通过了。

总结

  • 原因:可能是使用rpm 离线安装openssl库时,由于使用了–nodeps --force 这两个指令,忽略了openssl的依赖库,强制安装。导致openssl某些依赖,没有安装成功,从而导致openssl不可用。
  • 解决方法
    1)下载openssl 源码包
    2)解压到指定目录/data/openssl-1.1.0k
    3)执行./configure 时,添加–with-openssl=/data/openssl-1.1.0k参数

至此,问题成功解决。

http://www.lryc.cn/news/402361.html

相关文章:

  • 昇思25天学习打卡营第15天|两个分类实验
  • 实践:Redis6.0配置文件解读
  • 【Go系列】Go语言的网络服务
  • CS110L(Rust)
  • 免费恢复软件有哪些?电脑免费使用的 5 大数据恢复软件
  • Flink History Server配置
  • ASPICE过程改进原则:确保汽车软件开发的卓越性能
  • HDU1005——Number Sequence,HDU1006——Tick and Tick,HDU1007——Quoit Design
  • uniapp form表单校验
  • 构建RSS订阅机器人:观察者模式的实践与创新
  • 芯片基础 | `wire`类型引发的学习
  • 如何在AWS上构建Apache DolphinScheduler
  • Quartus II 13.1添加新的FPGA器件库
  • 【html】html的基础知识(面试重点)
  • Java 网络编程(TCP编程 和 UDP编程)
  • STM32 | 看门狗+RTC源码解析
  • filebeat,kafka,clickhouse,ClickVisual搭建轻量级日志平台
  • Django实战项目之进销存数据分析报表——第一天:Anaconda 环境搭建
  • Linux部署Prometheus+Grafana
  • 【视频讲解】神经网络、Lasso回归、线性回归、随机森林、ARIMA股票价格时间序列预测|附代码数据
  • 低代码前端框架Amis全面教程
  • Windows 如何安装和卸载 OneDrive?具体方法总结
  • c# .net core中间件,生命周期
  • Spring后端框架复习总结
  • 基于Llama Index构建RAG应用
  • SSLRec代码分析
  • 第四节shell条件测试(1)(2)
  • 申请https证书的具体流程
  • IP溯源工具--IPTraceabilityTool
  • 字节抖音电商 后端开发岗位 一面