解决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部分文件
解决Nginx编译时 openssl not found问题
解决方法
解决Nginx编译时 openssl not found问题
本文转载:
https://blog.csdn.net/fengchu3415/article/details/84061061
https://blog.csdn.net/u013091013/article/details/53640318