当前位置: 代码网 > it编程>游戏开发>ar > nginx安装时配置出错openssl library in … not found和error: SSL modules require the OpenSSL library. 的彻底解决

nginx安装时配置出错openssl library in … not found和error: SSL modules require the OpenSSL library. 的彻底解决

2024年08月03日 ar 我要评论
./configure: error: SSL modules require the OpenSSL library.You can either do not enable the modules, or install the OpenSSL libraryinto the system, or build the OpenSSL library statically from the sourcewith nginx by using --with-openssl= option.

目            录

一、问题描述(错误现象描述)

二、问题查处过程

1、查看openssl的版本

2、定位openssl所在目录

3、配置参数加上 openssl的目录

4、重装openssl

三、问题解决

1、openssl库路径匹配

2、--with-openssl路径配置


一、问题描述(错误现象描述)

        我们的程序原来正常运行,由于客户服务器做了系统更新(具体更新什么,客户也不知道)。导致我们的nginx运行出现错误

         想了很多办法处理,都没有处理好,最后只有在客户的环境重新编译nginx。

        在重新编译nginx的过程中,第一步配置./configure 就出现了错误,如下:

       注:客户服务器操作系统是 red hat enterprise linux 7.6

二、问题查处过程

1、查看openssl的版本

       看错误提示,应该 是nginx没有找到系统的中openssl的库文件,是不是ssl没有安装好?于是调用openssl version,能够清楚看到openssl版本

[root@localhost home]# openssl version
openssl 1.0.2k-fips  26 jan 2017
[root@localhost home]#

       显然,openssl是安装好的。

2、定位openssl所在目录

        那就有可能是openssl的路径问题了,nginx安装程序找到的路径是错误的。

       通过whereis openssl查找安装路径,如下命令,可以找到多个路径。

[root@localhost home]# whereis openssl

openssl: /usr/bin/openssl /usr/lib64/openssl /usr/include/openssl /usr/share/man/man1/openssl.1ssl.gz

[root@localhost home]#

       然后查找对应的openssl 的文件,找出路径为/usr/include/openssl,如下:

[root@localhost  home]#
[root@localhost  home]# find / -name  ssl.h
/usr/include/openssl/ssl.h
[root@localhost  home]#

        因此可以确定,原来系统文件的库文件路径是/usr/include/openssl,显然前面命令提示的,在/usr/local/等路径上都找不到,主要是路径错误。

3、配置参数加上 openssl的目录

       于是,在nginx配置configure  上增路径,如下

      配置问题过程,一切正常,错误不在,但是出现的新的错误:      

[root@localhost nginx-1.18.0]# make
make -f objs/makefile
make[1]: 进入目录“/home/nginx-1.18.0”
cd /usr/include/openssl \
&& if [ -f makefile ]; then make clean; fi \
&& ./config --prefix=/usr/include/openssl/.openssl no-shared no-threads  \
&& make \
&& make install_sw libdir=lib
/bin/sh:行2: ./config: 没有那个文件或目录
make[1]: *** [/usr/include/openssl/.openssl/include/openssl/ssl.h] 错误 127
make[1]: 离开目录“/home/nginx-1.18.0”
make: *** [build] 错误 2
[root@localhost nginx-1.18.0]#

4、重装openssl

       又出现新的问题,还是彻底一些,重装openssl吧!

       (1)首先登录openssl的官网:

                openssl的官网(https://www.openssl.org

        (2)然后进入openssl的旧版本路径 :

                     [ old releases ] - /source/old/index.html

        (3)由于我以前的系统是openssl 1.0.2k的版本,所以我尽量下载openssl 1.0.2k或者一户的版本。我下载的还是openssl 1.0.2k的版本,下载后安装,过程比较简单:

                ./configure

               make && make install

        比较顺利,一切正常。

三、问题解决

       重装openssl,nginx编译还是有点问题,又做了如下两项工作,才彻底解决问题:

1、openssl库路径匹配

       编译新的openssl时,openssl库路径没有和nginx编译配置的路径匹配好,导致无法找到openssl的库文件,造成的编译的configure出错。

       因此要修改nginx中openssl的配置文件,找到nginx安装目录下的文件“uto/lib/openssl/conf”,然后进行编辑:

        把lib修改为正确的lib64,如下图:

2、--with-openssl路径配置

          --with-openssl=<dir> 需要指定openssl库源路径,所以要把这个参数设定为“openssl 安装文件的所在路径”,因此,改动如下:

        没有出错,接着make && make install,一切过程顺利,最后生成可以运行的nginx文件。

        把nginx执行文件替换原来的nginx文件,正常运行。

        这次问题得到彻底解决。

若想了解更多,可以“点击” 下面的 “威迪斯特 微信名片”,就会出现我的二维码

(0)

相关文章:

版权声明:本文内容由互联网用户贡献,该文观点仅代表作者本人。本站仅提供信息存储服务,不拥有所有权,不承担相关法律责任。 如发现本站有涉嫌抄袭侵权/违法违规的内容, 请发送邮件至 2386932994@qq.com 举报,一经查实将立刻删除。

发表评论

验证码:
Copyright © 2017-2025  代码网 保留所有权利. 粤ICP备2024248653号
站长QQ:2386932994 | 联系邮箱:2386932994@qq.com