编译 nginx 失败:对 `SSL_get0_alpn_selected' 和 `SSL_CTX_set_alpn_select_cb' 的未定义引用

compiling nginx fails: undefined reference to `SSL_get0_alpn_selected' and `SSL_CTX_set_alpn_select_cb'

设备详情:
系统:Debian Jessie x86_64 服务器 (VPS)
Web 服务器:nginx 1.10.3(最新稳定版)
TLS/SSL 库:OpenSSL 1.0.2k(刚刚编译了最新的 LTS 版本)

问题详情:
问题:从源安装 nginx-1.10.3 和 nginx-1.11.13(都试过了)


情况:我已经有一个网络服务器运行,但是不幸的是nginx是用旧的OpenSSL 1.0.1t编译的,所以我不能使用HTTP/2 使用 ALPN。

$ nginx -V
nginx version: nginx/1.10.3
built by gcc 4.9.2 (Debian 4.9.2-10)
built with OpenSSL 1.0.1t  3 May 2016
TLS SNI support enabled

因此,由于 apt-get install --reinstall nginx 不会改变这一点,我认为我必须从源代码中 dpkg-buildpackagemake,而两者都会导致相同的错误。


问题:每次尝试,结果如下:

objs/src/event/ngx_event_openssl.o: In function `ngx_ssl_check_host':
/build/nginx-local/nginx-src/nginx-1.10.3/src/event/ngx_event_openssl.c:2997: undefined reference to `X509_check_host'
objs/src/http/ngx_http_request.o: In function `ngx_http_ssl_handshake_handler':
/build/nginx-local/nginx-src/nginx-1.10.3/src/http/ngx_http_request.c:780: undefined reference to `SSL_get0_alpn_selected'
objs/src/http/modules/ngx_http_ssl_module.o: In function `ngx_http_ssl_merge_srv_conf':
/build/nginx-local/nginx-src/nginx-1.10.3/src/http/modules/ngx_http_ssl_module.c:653: undefined reference to `SSL_CTX_set_alpn_select_cb'
collect2: error: ld returned 1 exit status
objs/Makefile:302: recipe for target 'objs/nginx' failed
make[1]: *** [objs/nginx] Error 1
make[1]: Leaving directory '/build/nginx-local/nginx-src/nginx-1.10.3'
Makefile:8: recipe for target 'build' failed
make: *** [build] Error 2

Config: 这是我之前使用的配置 make:

$ ./configure --prefix=/etc/nginx --sbin-path=/usr/sbin/nginx --modules-path=/usr/lib/nginx/modules --conf-path=/etc/nginx/nginx.conf --error-log-path=/var/log/nginx/error.log --http-log-path=/var/log/nginx/access.log --pid-path=/var/run/nginx.pid --lock-path=/var/run/nginx.lock --http-client-body-temp-path=/var/cache/nginx/client_temp --http-proxy-temp-path=/var/cache/nginx/proxy_temp --http-fastcgi-temp-path=/var/cache/nginx/fastcgi_temp --http-uwsgi-temp-path=/var/cache/nginx/uwsgi_temp --http-scgi-temp-path=/var/cache/nginx/scgi_temp --user=nginx --group=nginx --with-file-aio --with-threads --with-ipv6 --with-http_addition_module --with-http_auth_request_module --with-http_dav_module --with-http_flv_module --with-http_gunzip_module --with-http_gzip_static_module --with-http_mp4_module --with-http_random_index_module --with-http_realip_module --with-http_secure_link_module --with-http_slice_module --with-http_ssl_module --with-http_stub_status_module --with-http_sub_module --with-http_v2_module --with-mail --with-mail_ssl_module --with-stream --with-stream_ssl_module --with-cc-opt='-g -O2 -fstack-protector-strong -Wformat -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -fPIC' --with-ld-opt='-Wl,-z,relro -Wl,-z,now -Wl,--as-needed -pie'


提前感谢社区的帮助!


编辑:

现在我尝试了别的东西。所以我修改了 nginx-1.10.3 的源代码,根据修改编辑了变更日志,并在另一台设备(x64 Debian jessie 和 OpenSSL 1.0.2j)上使用 dpkg-buildpackage 构建了 .deb 包,并在我的设备上更新了它VPS,但这仍然会导致:

$ nginx -V
nginx version: nginx/1.10.3
built by gcc 4.9.2 (Debian 4.9.2-10)
built with OpenSSL 1.0.1t  3 May 2016
TLS SNI support enabled

新包更新成功(我更改了发送的HTTP服务器header以确认更改并将版本从1.10.3-1重命名为1.10.3-2)

所以 现在真正的问题是我如何管理使用 OpenSSL 1.0.2 构建的 nginx? 我现在完全迷失了。

修改后的包和源可以在my website之间找到。


编辑#2:

即使 VPS 的干净(最小)安装没有 openssl 或它上面的任何服务器也无济于事。我的意思是当使用原始源代码编译 OpenSSL 1.0.2k 和 nginx 1.12 时(不是任何 debian 软件包或 repos 上的源代码,因为 Debian 通常往往有旧版本)似乎仍然无法工作并导致 nginx 使用 openSSL 1.0 编译。 1t.

我的假设:

libssl 和 libssl-dev(我对那些包使用了 apt-get)会影响这个吗?

不知何故 nginx 仍然使用 Debian 存储库中可用的最多 'actual' openSSL 版本? (是的,自 1.0.1t 以来,Debian 仍然没有更新他们的 openSSL 软件包)

好吧,如果我有更多时间尝试更多东西,我会更新

我通过从源代码构建 openssl 并将 --with-openssl=../openssl-1.0.2k 添加到 nginx 的 ./configure 命令解决了同样的问题。 可能与 Debian 的 openssl 版本不兼容?