【解决】Centos7 内网环境 离线安装 nginx checking for OpenSSL library in /xxx/xx ... not found 问题

查看系统是否安装 openssl,如下 openssl已安装,但是没有安装 openssl-devel

[root@summergao nginx-1.27.3]# rpm -qa |grep openssl
openssl-1.0.2k-16.el7_6.1.x86_64
openssl-libs-1.0.2k-16.el7_6.1.x86_64
[root@summergao nginx-1.27.3]# yum list installed |grep openssl-devel
[root@summergao nginx-1.27.3]# 

 进入Nginx安装包

[root@summergao data]# cd nginx-1.27.3
[root@summergao nginx-1.27.3]# pwd
/data/nginx-1.27.3
[root@summergao nginx-1.27.3]# ls
auto  CHANGES  CHANGES.ru  CODE_OF_CONDUCT.md  conf  configure  contrib  CONTRIBUTING.md  html  LICENSE  Makefile  man  objs  README.md  SECURITY.md  src
[root@summergao nginx-1.27.3]# 

执行配置检测 ./configure 命令

./configure  --prefix=/data/nginx --with-http_stub_status_module --with-http_ssl_module --with-http_stub_status_module --with-http_realip_module --with-threads --with-stream --with-stream_ssl_preread_module --with-stream_ssl_module --without-http_rewrite_module

报错如下

checking for POSIX semaphores in libpthread ... found
checking for struct msghdr.msg_control ... found
checking for ioctl(FIONBIO) ... found
checking for ioctl(FIONREAD) ... found
checking for struct tm.tm_gmtoff ... found
checking for struct dirent.d_namlen ... not found
checking for struct dirent.d_type ... found
checking for sysconf(_SC_NPROCESSORS_ONLN) ... found
checking for sysconf(_SC_LEVEL1_DCACHE_LINESIZE) ... found
checking for openat(), fstatat() ... found
checking for getaddrinfo() ... 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
checking for OpenSSL library in /opt/homebrew/ ... 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库,一种解决方案:根据提示我们可以根据提示从源代码静态地构建OpenSSL库

从OpenSSL官网下载OPENSSL,下载地址:https://www.openssl.org/source/

我这里需要下载老版本:openssl-1.0.2k.tar.gz

 https://openssl-library.org/source/old/1.0.2/index.html

将资源文件下载上传至服务器 /data/ 下并解压。

[root@summergao data]# tar -zxvf openssl-1.0.2k.tar.gz 

 解压完成后,重新使用 –with-openssl= 参数指定检查配置时使用的openssl库,配置检测:

./configure  --prefix=/data/nginx --with-http_stub_status_module --with-http_ssl_module --with-http_stub_status_module --with-http_realip_module --with-threads --with-stream --with-stream_ssl_preread_module --with-stream_ssl_module --without-http_rewrite_module --with-openssl=/data/openssl-1.0.2k

 然后编译安装即可(安装位置:/data/nginx)

[root@summergao nginx-1.27.3]#  make && make install

进入nginx安装目录sbin目录下执行命令检查是否成功安装ssl模块

[root@summergao sbin]# cd /data/nginx/sbin/ && ./nginx -V
nginx version: nginx/1.27.3
built by gcc 4.8.5 20150623 (Red Hat 4.8.5-36) (GCC) 
built with OpenSSL 1.0.2k  26 Jan 2017
TLS SNI support enabled
configure arguments: --prefix=/data/nginx --with-http_stub_status_module --with-http_ssl_module --with-http_stub_status_module --with-http_realip_module --with-threads --with-stream --with-stream_ssl_preread_module --with-stream_ssl_module --without-http_rewrite_module --with-openssl=/data/openssl-1.0.2k
[root@summergao sbin]# 

至此Nginx安装完成

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

SummerGao.

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值