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. 的彻底解决。希望对大家有所帮助。如果存在错误或未考虑完全的地方,请大家不吝赐教,您也可以点击"举报违法"按钮提交疑问。

目            录

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

二、问题查处过程

1、查看openssl的版本

2、定位openssl所在目录

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

4、重装openssl

三、问题解决

1、openssl库路径匹配

2、--with-openssl路径配置


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

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

nginx: [emerg] the “ssl” parameter requires ngx_http_ssl_module in /home/nginx. conf:83

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

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

./configure  --prefix=/home/nginx-bin --with-http_ssl_module 

……………………………

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.

       注:客户服务器操作系统是 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  上增路径,如下

./configure --prefix=/home/nginx-bin --with-http_ssl_module --with-openssl=/usr/include/openssl

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

[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”,然后进行编辑:

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

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

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

2、--with-openssl路径配置

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

./configure --prefix=/home/nginx-bin --with-http_ssl_module --with-openssl=/home/nginx1180/openssl-1.0.2k

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

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

        这次问题得到彻底解决。

若想了解更多,可以“点击” 下面的 “威迪斯特 微信名片”,就会出现我的二维码文章来源地址https://www.toymoban.com/news/detail-842194.html

到了这里,关于nginx安装时配置出错openssl library in … not found和error: SSL modules require the OpenSSL library. 的彻底解决的文章就介绍完了。如果您还想了解更多内容,请在右上角搜索TOY模板网以前的文章或继续浏览下面的相关文章,希望大家以后多多支持TOY模板网!

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处: 如若内容造成侵权/违法违规/事实不符,请点击违法举报进行投诉反馈,一经查实,立即删除!

领支付宝红包 赞助服务器费用

相关文章

觉得文章有用就打赏一下文章作者

支付宝扫一扫打赏

博客赞助

微信扫一扫打赏

请作者喝杯咖啡吧~博客赞助

支付宝扫一扫领取红包,优惠每天领

二维码1

领取红包

二维码2

领红包