目? ? ? ? ? ? 錄
一、問題描述(錯(cuò)誤現(xiàn)象描述)
二、問題查處過程
1、查看openssl的版本
2、定位openssl所在目錄
3、配置參數(shù)加上 openssl的目錄
4、重裝openssl
三、問題解決
1、openssl庫路徑匹配
2、--with-openssl路徑配置
一、問題描述(錯(cuò)誤現(xiàn)象描述)
????????我們的程序原來正常運(yùn)行,由于客戶服務(wù)器做了系統(tǒng)更新(具體更新什么,客戶也不知道)。導(dǎo)致我們的nginx運(yùn)行出現(xiàn)錯(cuò)誤
nginx: [emerg] the “ssl” parameter requires ngx_http_ssl_module in /home/nginx. conf:83
?????????想了很多辦法處理,都沒有處理好,最后只有在客戶的環(huán)境重新編譯nginx。
????????在重新編譯Nginx的過程中,第一步配置./configure 就出現(xiàn)了錯(cuò)誤,如下:
./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.
? ? ? ?注:客戶服務(wù)器操作系統(tǒng)是 Red Hat Enterprise Linux 7.6
二、問題查處過程
1、查看openssl的版本
?????? 看錯(cuò)誤提示,應(yīng)該 是nginx沒有找到系統(tǒng)的中openssl的庫文件,是不是ssl沒有安裝好?于是調(diào)用openssl version,能夠清楚看到openssl版本
[root@localhost home]# openssl version
OpenSSL 1.0.2k-fips? 26 Jan 2017
[root@localhost home]#
?????? 顯然,openssl是安裝好的。
2、定位openssl所在目錄
????????那就有可能是openssl的路徑問題了,nginx安裝程序找到的路徑是錯(cuò)誤的。
?????? 通過whereis openssl查找安裝路徑,如下命令,可以找到多個(gè)路徑。
[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]#
?????? 然后查找對(duì)應(yīng)的openssl 的文件,找出路徑為/usr/include/openssl,如下:
[root@localhost? home]#
[root@localhost? home]# find / -name? ssl.h
/usr/include/openssl/ssl.h
[root@localhost? home]#
????????因此可以確定,原來系統(tǒng)文件的庫文件路徑是/usr/include/openssl,顯然前面命令提示的,在/usr/local/等路徑上都找不到,主要是路徑錯(cuò)誤。
3、配置參數(shù)加上 openssl的目錄
?????? 于是,在nginx配置configure? 上增路徑,如下
./configure --prefix=/home/nginx-bin --with-http_ssl_module --with-openssl=/usr/include/openssl
??????配置問題過程,一切正常,錯(cuò)誤不在,但是出現(xiàn)的新的錯(cuò)誤:??????
[root@localhost nginx-1.18.0]# make
make -f objs/Makefile
make[1]: 進(jìn)入目錄“/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: 沒有那個(gè)文件或目錄
make[1]: *** [/usr/include/openssl/.openssl/include/openssl/ssl.h] 錯(cuò)誤 127
make[1]: 離開目錄“/home/nginx-1.18.0”
make: *** [build] 錯(cuò)誤 2
[root@localhost nginx-1.18.0]#
4、重裝openssl
?????? 又出現(xiàn)新的問題,還是徹底一些,重裝openssl吧!
? ? ? ?(1)首先登錄openssl的官網(wǎng):
????????????????openssl的官網(wǎng)(https://www.openssl.org)
? ? ? ? (2)然后進(jìn)入openssl的舊版本路徑 :
???????????????????? [ Old Releases ] - /source/old/index.html
? ? ? ? (3)由于我以前的系統(tǒng)是OpenSSL 1.0.2k的版本,所以我盡量下載OpenSSL 1.0.2k或者一戶的版本。我下載的還是OpenSSL 1.0.2k的版本,下載后安裝,過程比較簡(jiǎn)單:
????????????????./configure
?????? ????????Make && make install
????????比較順利,一切正常。
三、問題解決
?????? 重裝openssl,nginx編譯還是有點(diǎn)問題,又做了如下兩項(xiàng)工作,才徹底解決問題:
1、openssl庫路徑匹配
?????? 編譯新的openssl時(shí),openssl庫路徑?jīng)]有和nginx編譯配置的路徑匹配好,導(dǎo)致無法找到openssl的庫文件,造成的編譯的configure出錯(cuò)。
?????? 因此要修改nginx中openssl的配置文件,找到nginx安裝目錄下的文件“uto/lib/openssl/conf”,然后進(jìn)行編輯:
????????把lib修改為正確的lib64,如下圖:
2、--with-openssl路徑配置
??????????--with-openssl=<dir> 需要指定openssl庫源路徑,所以要把這個(gè)參數(shù)設(shè)定為“openssl 安裝文件的所在路徑”,因此,改動(dòng)如下:
./configure --prefix=/home/nginx-bin --with-http_ssl_module --with-openssl=/home/nginx1180/openssl-1.0.2k
????????沒有出錯(cuò),接著make && make install,一切過程順利,最后生成可以運(yùn)行的nginx文件。
????????把nginx執(zhí)行文件替換原來的nginx文件,正常運(yùn)行。
????????這次問題得到徹底解決。文章來源:http://www.zghlxwxcb.cn/news/detail-842194.html
若想了解更多,可以“點(diǎn)擊” 下面的 “威迪斯特?微信名片”,就會(huì)出現(xiàn)我的二維碼。文章來源地址http://www.zghlxwxcb.cn/news/detail-842194.html
到了這里,關(guān)于nginx安裝時(shí)配置出錯(cuò)openssl library in … not found和error: SSL modules require the OpenSSL library. 的徹底解決的文章就介紹完了。如果您還想了解更多內(nèi)容,請(qǐng)?jiān)谟疑辖撬阉鱐OY模板網(wǎng)以前的文章或繼續(xù)瀏覽下面的相關(guān)文章,希望大家以后多多支持TOY模板網(wǎng)!