V2EX = way to explore
V2EX 是一个关于分享和探索的地方
现在注册
已注册用户请  登录
NGINX
NGINX Trac
3rd Party Modules
Security Advisories
CHANGES
OpenResty
ngx_lua
Tengine
在线学习资源
NGINX 开发从入门到精通
NGINX Modules
ngx_echo
ColinZeb
V2EX  ›  NGINX

Centos 7.4 openssl 都升级 1.0.2k-fips 了,为什么最新版 nginx 还是不支持 http2

  •  
  •   ColinZeb ·
    ColinZeb · 2017-09-24 15:12:53 +08:00 · 8673 次点击
    这是一个创建于 2378 天前的主题,其中的信息可能已经有所发展或是发生改变。

    nginx version: nginx/1.13.5

    built by gcc 4.8.5 20150623 (Red Hat 4.8.5-11) (GCC)

    built with OpenSSL 1.0.1e-fips 11 Feb 2013

    这是 mainline 版本,stable 版本也是这样。 用的 nginx 官方库,为啥 nginx 不用最新版 openssl 编译呢

    第 1 条附言  ·  2017-09-25 00:26:35 +08:00
    我编译了一个,提供一个配置供大家参考

    ./configure \--prefix=/etc/nginx --sbin-path=/usr/sbin/nginx --modules-path=/usr/lib64/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-openssl=../openssl-1.0.2l \
    --with-http_ssl_module \
    --with-http_v2_module \
    --with-http_realip_module \
    --with-http_addition_module \
    --with-http_sub_module \
    --with-http_dav_module \
    --with-http_flv_module \
    --with-http_mp4_module \
    --with-http_gunzip_module \
    --with-http_gzip_static_module \
    --with-http_random_index_module \
    --with-http_secure_link_module \
    --with-http_stub_status_module \
    --with-http_auth_request_module \
    --with-http_image_filter_module \
    --with-http_slice_module \
    --with-mail \
    --with-threads \
    --with-file-aio \
    --with-mail_ssl_module \
    --with-stream_ssl_module \
    --with-pcre=../pcre-8.41 \
    --with-zlib=../zlib-1.2.11
    23 条回复    2017-09-25 21:10:04 +08:00
    XiaoFaye
        1
    XiaoFaye  
       2017-09-24 15:17:37 +08:00
    nginx 用 http2 可以呀,你的问题具体是?
    LosLord
        2
    LosLord  
       2017-09-24 15:21:24 +08:00 via Android
    @XiaoFaye 之前 centos 的 openssl 版本低,就算启用 nginx 的 http2,也不会生效。
    tangren
        3
    tangren  
       2017-09-24 15:24:34 +08:00
    装了 openssl1.0.2 之后要重新编译 nginx+openssl hostname ssl http2
    tangren
        4
    tangren  
       2017-09-24 15:26:30 +08:00
    也可以装这个 nginx openresty 版本 默认就开了
    rrfeng
        5
    rrfeng  
       2017-09-24 17:19:54 +08:00
    一般 nginx 编译都是拉最新 openssl 的(当然不要跨大版本,除非你自己可以做完整的测试)

    低版本 openssl 不支持 alpn 只有 npn,然而目前多数客户端已经废弃 npn 了,所以连不上 http2
    Terenc3
        6
    Terenc3  
       2017-09-24 21:42:56 +08:00
    升级系统的 openssl 后要重新编译 nginx,因为我一直是自行编译 nginx,所以不知道各个 yum 源的情况。

    另外在编译的时候要启用以下两个模块:
    --with-http_v2_module
    --with-http_ssl_module

    最后可以看一下我的文章:

    https://c4.hk/4c
    flynaj
        7
    flynaj  
       2017-09-24 23:53:06 +08:00 via Android
    nginx 官方的早就支持了
    ColinZeb
        8
    ColinZeb  
    OP
       2017-09-24 23:54:06 +08:00
    @tangren 这个没用过,他的版本和 nginx 是同步的吗,比如 1.11 是指用的 nginx 的 1.11 的源码编译的吗
    ColinZeb
        9
    ColinZeb  
    OP
       2017-09-24 23:55:01 +08:00
    @flynaj 但是 centos 仓库里并没有支持,看 nginx -V 里的 openssl 版本还是 1.01e
    tradzero
        10
    tradzero  
       2017-09-25 00:34:57 +08:00 via Android
    貌似 rpm 源 用高版本编译的在商业版本里 特地要卖你钱
    msg7086
        11
    msg7086  
       2017-09-25 06:21:52 +08:00
    @ColinZeb 你说的 centos 仓库,是说的 centos 官方的 repo,还是 EPEL 的 repo,还是 nginx 的 repo ?
    ColinZeb
        12
    ColinZeb  
    OP
       2017-09-25 08:14:29 +08:00 via Android
    @msg7086 nginx 官方
    byfar
        13
    byfar  
       2017-09-25 08:33:45 +08:00   ❤️ 1
    都 12 楼了,怎么还没有推荐 docker 没记错 nginx:alpine 是支持 http2 的
    Cat73
        14
    Cat73  
       2017-09-25 09:06:28 +08:00
    前两天我也遇到了这个问题。。。
    找了个 rpm 源搞定的问题 0.0
    ColinZeb
        15
    ColinZeb  
    OP
       2017-09-25 09:29:49 +08:00
    @Cat73 什么源
    mritd
        16
    mritd  
       2017-09-25 09:35:11 +08:00 via iPhone
    Docker nginx:alpine
    owt5008137
        17
    owt5008137  
       2017-09-25 11:11:54 +08:00 via Android
    我猜他打包 rpm 的机器还是 openssl 1.0.1 吧,编译的时候就决定好了各项开关了所以你单单升 openssl 没用。

    https://github.com/owent-utils/bash-shell/blob/master/LNMP/nginx_with_http2_for_el7.sh
    来来来,一键编译 nginx + openssl 1.1.0。稳定分支,编译选项从 nginx 官网抄的
    msg7086
        18
    msg7086  
       2017-09-25 11:29:15 +08:00
    @ColinZeb nginx 的官方用的包不一定会跟着 centos 的最新版走。
    Cat73
        19
    Cat73  
       2017-09-25 13:59:52 +08:00
    @ColinZeb 我用的 https://brouken.com/brouken.repo,不过我不能确保安全性,只能说这个是支持 HTTP2 的,因此你得自己鉴别确定安全再用。
    Showfom
        20
    Showfom  
       2017-09-25 15:14:15 +08:00 via iPhone
    自己编译可破
    Showfom
        21
    Showfom  
       2017-09-25 15:15:10 +08:00 via iPhone
    @owt5008137 是的 官方编译的时候用的默认的低版本
    flynaj
        22
    flynaj  
       2017-09-25 20:00:05 +08:00 via Android
    ColinZeb
        23
    ColinZeb  
    OP
       2017-09-25 21:10:04 +08:00 via Android
    @flynaj 我就是用这个
    关于   ·   帮助文档   ·   博客   ·   API   ·   FAQ   ·   我们的愿景   ·   实用小工具   ·   3680 人在线   最高记录 6543   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 26ms · UTC 10:25 · PVG 18:25 · LAX 03:25 · JFK 06:25
    Developed with CodeLauncher
    ♥ Do have faith in what you're doing.