nginx

关注公众号 jb51net

关闭
首页 > 网站技巧 > 服务器 > nginx > Nginx编译时openssl not found

Nginx编译时openssl not found问题及解决过程

作者:enjoy嚣士

本文介绍了Nginx编译时报openssl not found错误的解决方法,主要是因为Nginx查找的路径没有包含OpenSSL库的位置,将库文件移动或复制到Nginx查找的路径下即可

Nginx编译时openssl not found

有时候因为nginx升级之后使用了高版本的Openssl,本地需要添加新模块重新编译nginx时候要升级openssl至指定版本。

源码安装Openssl之后重新编译Nginx会报如下错误:

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= option.

其实是OpenSSL的库没有找到。 nginx查找的路径为:/usr/local/ ; /usr/pkg/; /opt/local;

只要把刚刚源码编译生成的库放到对应目录就可以了。

以我的机器Centos7 64位系统为例。openSSL源码编译安装后,库的位置为

/usr/local/lib64

于是我把此目录下的库移动到/usr/local下。

再次编译的时候还是报错:

OpenSSL library not found.

重新看了下配置的脚本发现。

原来Nginx是在 /usr/local/lib; /usr/pkg/lib; /opt/local/lib; 这三个路径下去查找;

把库拷贝到 /usr/local/lib下即可编译。

注上面是别人写的:

我为了偷懒,使用ln -s命令创建链接,发现不行。最后还是老老实实直接cp过去比较好。

下面是源码编译时找不到openssl部分文件

解决方法


 

总结

以上为个人经验,希望能给大家一个参考,也希望大家多多支持脚本之家。

您可能感兴趣的文章:
阅读全文