ICode9

精准搜索请尝试: 精确搜索
首页 > 系统相关> 文章详细

【问题解决】源码安装Nginx提示找不到openssl library

2022-09-08 12:02:47  阅读:185  来源: 互联网

标签:openssl library OpenSSL 源码 found 安装


问题背景

最近测试同事说有一台服务器执行源码安装Nginx脚本出现openssl not found的错误解决不了让我帮忙看看,ssh连接上去后发现这台服务器安装了 CentOS7.9操作系统,并且已经安装了 openssl-devel 库,理论上不会有问题。

然而,就在重装多次 openssl相关软件包后,感觉问题不大正常,于是再次仔细查看报错信息:

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.

大意是没找到OpenSSL库,而Nginx的SSL模块需要OpenSSL库,要么禁用这个模块,要么安装OpenSSL库;也可以通过指定OpenSSL源码位置来静态编译OpenSSL供Nginx使用。

检查openssl-devel安装情况 yum list installed |grep openssl-devel,发现的确安装了

[root@cfs-ctp nginx]# yum list installed |grep openssl-devel
openssl-devel.x86_64                       1:1.0.2k-25.el7_9           @updates

尝试执行了下 openssl version 查看openssl的版本

[root@cfs-ctp nginx]# openssl version
openssl: relocation error: openssl: symbol OPENSSL_init_ssl, version OPENSSL_1_1_0 not defined in file libssl.so.1.1 with link time reference

yum安装的版本是1.0.2k,而提示却是OPENSSL_1_1_0,我怀疑 openssl 安装有问题。

解决方法

由于在网上百度到OpenSSL library in /usr/local/ ... not found这种标题的帖子解决办法都非常离谱——指定OpenSSL源码静态编译 或 手动编译OpenSSL后复制到某个位置,再有怀疑OpenSSL安装有问题,直接去查OpenSSL的报错信息,发现了全网(截至2022/09/08)唯一一篇情况大致相同的贴子,来自ArchLinux论坛 https://archlinuxarm.org/forum/viewtopic.php?t=11679&p=55714

于是全局搜索下 openssl 目录,看看有没有源码安装目录

[root@cfs-ctp ~]# find / -name openssl
find: ‘/proc/42458’: 没有那个文件或目录
/etc/pki/ca-trust/extracted/openssl
/root/nginx/nginx-1.22.0/auto/lib/openssl
/usr/bin/openssl
/usr/lib64/openssl
/usr/include/openssl
/data/jq/rpms/openssl-1.1.1a/test/ossl_shim/include/openssl
/data/jq/rpms/openssl-1.1.1a/apps/openssl
/data/jq/rpms/openssl-1.1.1a/include/openssl
/data/jq/rpms/tengine-2.3.0/auto/lib/openssl

的确发现1.1.1版本的源码目录,进入后执行卸载操作

cd /data/jq/rpms/openssl-1.1.1a
make uninstall

再次执行源码安装nginx的脚本,一切正常。

提示:源码安装系统组件一定要保留编译安装目录,不然出现这种情况基本就得重装系统了。

标签:openssl,library,OpenSSL,源码,found,安装
来源: https://www.cnblogs.com/hellxz/p/16668957.html

本站声明: 1. iCode9 技术分享网(下文简称本站)提供的所有内容,仅供技术学习、探讨和分享;
2. 关于本站的所有留言、评论、转载及引用,纯属内容发起人的个人观点,与本站观点和立场无关;
3. 关于本站的所有言论和文字,纯属内容发起人的个人观点,与本站观点和立场无关;
4. 本站文章均是网友提供,不完全保证技术分享内容的完整性、准确性、时效性、风险性和版权归属;如您发现该文章侵犯了您的权益,可联系我们第一时间进行删除;
5. 本站为非盈利性的个人网站,所有内容不会用来进行牟利,也不会利用任何形式的广告来间接获益,纯粹是为了广大技术爱好者提供技术内容和技术思想的分享性交流网站。

专注分享技术,共同学习,共同进步。侵权联系[81616952@qq.com]

Copyright (C)ICode9.com, All Rights Reserved.

ICode9版权所有