升级openssl后nginx无法编译安装问题之解决方法

  Linux下升级openssl到新版本(如CentOS 7中openssl升级到openssl 1.1.1d)后,其实原nginx并没有真正调用新的openssl 1.1.1d。怎么办呢?需对nginx重新编译,但在编译安装过程中有人就无法编译nginx了,遇到如下问题:

[root@centos7 nginx-1.16.1]# make
make -f objs/Makefile
make[1]: 进入目录“/usr/local/src/nginx-1.16.1”
cd /usr/local/openssl
&& if [ -f Makefile ]; then make clean; fi
&& ./config --prefix=/usr/local/openssl/.openssl no-shared no-threads
&& make
&& make install_sw LIBDIR=lib
/bin/sh:行2: ./config: 没有那个文件或目录
make[1]: *** [/usr/local/openssl/.openssl/include/openssl/ssl.h] 错误 127
make[1]: 离开目录“/usr/local/src/nginx-1.16.1”
make: *** [build] 错误 2

怎么办呢?解决办法如下:

进入/usr/local/src/nginx-1.16.1/auto/lib/openssl中
#vim conf


39 CORE_INCS="$CORE_INCS O P E N S S L / . o p e n s s l / i n c l u d e " 40 C O R E D E P S = " OPENSSL/.openssl/include" 40 CORE_DEPS=" OPENSSL/.openssl/include"40COREDEPS="CORE_DEPS O P E N S S L / . o p e n s s l / i n c l u d e / o p e n s s l / s s l . h " 41 C O R E L I B S = " OPENSSL/.openssl/include/openssl/ssl.h" 41 CORE_LIBS=" OPENSSL/.openssl/include/openssl/ssl.h"41CORELIBS="CORE_LIBS O P E N S S L / . o p e n s s l / l i b / l i b s s l . a " 42 C O R E L I B S = " OPENSSL/.openssl/lib/libssl.a" 42 CORE_LIBS=" OPENSSL/.openssl/lib/libssl.a"42CORELIBS="CORE_LIBS O P E N S S L / . o p e n s s l / l i b / l i b c r y p t o . a " … 将 上 述 改 为 : . . . 39 C O R E I N C S = " OPENSSL/.openssl/lib/libcrypto.a" … 将上述改为: ... 39 CORE_INCS=" OPENSSL/.openssl/lib/libcrypto.a"...39COREINCS="CORE_INCS O P E N S S L / i n c l u d e " 40 C O R E D E P S = " OPENSSL/include" 40 CORE_DEPS=" OPENSSL/include"40COREDEPS="CORE_DEPS O P E N S S L / i n c l u d e / o p e n s s l / s s l . h " 41 C O R E L I B S = " OPENSSL/include/openssl/ssl.h" 41 CORE_LIBS=" OPENSSL/include/openssl/ssl.h"41CORELIBS="CORE_LIBS O P E N S S L / l i b / l i b s s l . a " 42 C O R E L I B S = " OPENSSL/lib/libssl.a" 42 CORE_LIBS=" OPENSSL/lib/libssl.a"42CORELIBS="CORE_LIBS $OPENSSL/lib/libcrypto.a"

也即去掉.openssl/就行。
改后:
#make clean
再依次执行./configure … ;make ;make install即重新编译安装即可。

你可能感兴趣的:(Linux系统专区)