【问题标题】:compiling nginx fails: undefined reference to `SSL_get0_alpn_selected' and `SSL_CTX_set_alpn_select_cb'编译 nginx 失败:未定义对“SSL_get0_alpn_selected”和“SSL_CTX_set_alpn_select_cb”的引用
【发布时间】:2017-04-06 00:05:46
【问题描述】:

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

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


情况:我已经启动并运行了一个 Web 服务器,但不幸的是 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

配置:这是我在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 Server 标头以确认更改并将版本从 1.10.3-1 重命名为 1.10.3-2)

所以现在真正的问题是如何管理使用 OpenSSL 1.0.2 构建的 nginx?我现在对此很迷茫。

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


编辑#2:

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

我的假设:

libssl 和 libssl-dev(我对这些软件包使用了 apt-get)可能会影响这一点?

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

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

【问题讨论】:

  • 要在 debian 上使用更新的 openssl 版本,请考虑使用 repo deb https://packages.sury.org/php {distroName} main。您将在那里获得更新的 php 和 openssl 版本。

标签: nginx makefile openssl debian dpkg


【解决方案1】:

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

【讨论】:

  • 我没有继续尝试了。但是不,当时的 `--with-openssl=path/to/openssl´ 也不起作用。这是我自己编译 openssl 并在配置中使用 with-openssl 的第一种方法
  • 它解决了我的问题,对于遇到相同问题的其他人,我建议尝试一下...
猜你喜欢
  • 2016-10-15
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2017-08-11
  • 1970-01-01
  • 2012-08-16
  • 2013-11-20
  • 2023-03-10
相关资源
最近更新 更多