Nginx升级SSL报错nginx: [emerg] SSL_CTX_new() failed

环境

CentOS 7.5 + Nginx 1.25.3

配置命令

./configure --prefix=/data/nginx \
--with-http_ssl_module \
--with-pcre=/root/pcre-8.42 \
--with-zlib=/root/zlib-1.2.11 \
--with-openssl=/root/openssl-1.1.1

安装后报错如下:

$ ../sbin/nginx -t
nginx: [alert] OPENSSL_init_ssl() failed
nginx: [emerg] SSL_CTX_new() failed
nginx: configuration file /data/nginx/conf/nginx.conf test failed

解决

说是与OpenSSL的版本兼容有问题,直接搞最新版本的吧

./configure --prefix=/data/nginx \
--with-http_ssl_module \
--with-pcre=/root/pcre-8.42 \
--with-zlib=/root/zlib-1.2.11 \
--with-openssl=/root/openssl-3.2.0 # 就是这个openssl的版本

参考

https://github.com/alibaba/tengine/issues/1001