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

Nginx 的 HTTP2 谁配置成功了?

  •  
  •   Andy1999 · 2015-10-14 21:00:15 +08:00 via iPhone · 5468 次点击
    这是一个创建于 3335 天前的主题,其中的信息可能已经有所发展或是发生改变。
    编译 Nginx1.9.5 加入了 http_v2_module
    openssl 升级到了 1.0.2
    listen 443 ssl http2 依然无效
    请问有人成功过吗?求教程啊
    yeyeye
        1
    yeyeye  
       2015-10-14 22:39:56 +08:00
    帮你谷歌了下,小弟的建议是一字不差的抄过去,看了几个都是一样的配置方法,只能建议您把 nginx 的支持功能列表查看一下(小弟记得可以查看编译了多少包进去,就知道支持啥功能了)
    server {
    listen 443 ssl http2 default_server;
    ssl_certificate server.crt;
    ssl_certificate_key server.key;
    ...
    }

    来源
    http://www.cnbeta.com/articles/434667.htm
    https://imququ.com/post/nginx-http2-patch.html
    https://winclient.cn/nginx-1-9-5-release-support-http2/

    免责条款
    小弟是菜鸟,表打我,表 bLoCk 我,最好是忽视我的存在
    tms
        2
    tms  
       2015-10-14 23:35:06 +08:00
    https://tms.im/tms/nginx-http2
    推广自己 blog 的好时候
    Andy1999
        3
    Andy1999  
    OP
       2015-10-14 23:40:13 +08:00 via iPhone
    @yeyeye
    @tms [root@localhost ~]# nginx -V
    nginx version: nginx/1.9.5
    built by gcc 4.4.7 20120313 (Red Hat 4.4.7-16) (GCC)
    built with OpenSSL 1.0.1e-fips 11 Feb 2013
    TLS SNI support enabled
    configure arguments: --user=www --group=www --prefix=/usr/local/nginx --with-http_stub_status_module --with-http_ssl_module --with-http_v2_module --with-http_gzip_static_module --with-ipv6 --with-http_sub_module

    Last login: Mon Oct 12 22:15:54 2015 from 125.227.87.232
    [root@localhost ~]# nginx -V
    nginx version: nginx/1.9.5
    built by gcc 4.4.7 20120313 (Red Hat 4.4.7-16) (GCC)
    built with OpenSSL 1.0.1e-fips 11 Feb 2013
    TLS SNI support enabled
    configure arguments: --user=www --group=www --prefix=/usr/local/nginx --with-http_stub_status_module --with-http_ssl_module --with-http_v2_module --with-http_gzip_static_module --with-ipv6 --with-http_sub_module
    [root@localhost ~]# cat /usr/local/nginx/conf/vhost/dl.andy1999.com.conf
    server
    {
    listen 80;
    #listen [::]:80;
    server_name dl.andy1999.com;
    index index.html index.htm index.php default.html default.htm default.php;
    root /home/wwwroot/dl.andy1999.com;
    include other.conf;
    #error_page 404 /404.html;
    location ~ [^/]\.php(/|$)
    {
    # comment try_files $uri =404; to enable pathinfo
    try_files $uri =404;
    fastcgi_pass unix:/tmp/php-cgi.sock;
    fastcgi_index index.php;
    include fastcgi.conf;
    #include pathinfo.conf;
    }

    location ~ .*\.(gif|jpg|jpeg|png|bmp|swf)$
    {
    expires 30d;
    }

    location ~ .*\.(js|css)?$
    {
    expires 12h;
    }

    access_log /home/wwwlogs/dl.andy1999.com.log access;
    }
    server {
    listen 443 ssl http2;
    server_name dl.andy1999.com ;
    ssl on;
    ssl_certificate /usr/local/nginx/conf/vhost/andy1999.com.crt;
    ssl_certificate_key /usr/local/nginx/conf/vhost/andy1999.com.key;

    ssl_dhparam /usr/local/nginx/conf/vhost/dhparam.pem;
    ssl_session_cache shared:SSL:10m;
    ssl_session_timeout 10m;

    ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
    ssl_stapling on;
    ssl_ciphers "ECDHE-RSA-AES128-GCM-SHA256:ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-RSA-AES256-GCM-SHA384:ECDHE-ECDSA-AES256-GCM-SHA384:ECDHE-RSA-AES128-SHA256:ECDHE-ECDSA-AES128-SHA256:ECDHE-RSA-AES128-SHA:ECDHE-ECDSA-AES128-SHA:ECDHE-RSA-AES256-SHA384:ECDHE-ECDSA-AES256-SHA384:ECDHE-RSA-AES256-SHA:ECDHE-ECDSA-AES256-SHA:AES128-GCM-SHA256:AES256-GCM-SHA384:AES128-SHA256:AES256-SHA256:AES128-SHA:AES256-SHA:AES:CAMELLIA:DES-CBC3-SHA:!aNULL:!eNULL:!EXPORT:!DES:!RC4:!MD5:!PSK:!aECDH:!EDH-DSS-DES-CBC3-SHA:!EDH-RSA-DES-CBC3-SHA:!KRB5-DES-CBC3-SHA";
    ssl_prefer_server_ciphers on;

    add_header Strict-Transport-Security "max-age=63072000; includeSubdomains; preload";
    index index.html index.htm index.php default.html default.htm default.php;
    root /home/wwwroot/dl.andy1999.com;
    location ~ .*\.(gif|jpg|jpeg|png|bmp|swf)$
    {
    expires 30d;
    }

    location ~ .*\.(js|css)?$
    {
    expires 12h;
    }

    access_log /home/wwwlogs/dl.andy1999.com.log access;
    Andy1999
        4
    Andy1999  
    OP
       2015-10-14 23:40:50 +08:00 via iPhone
    然而并无卵用 日了妹了
    udumbara
        5
    udumbara  
       2015-10-15 02:44:59 +08:00
    Joming
        6
    Joming  
       309 天前
    不喜欢折腾了,直接套个 CDN 解决。
    关于   ·   帮助文档   ·   博客   ·   API   ·   FAQ   ·   实用小工具   ·   2698 人在线   最高记录 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 22ms · UTC 07:39 · PVG 15:39 · LAX 23:39 · JFK 02:39
    Developed with CodeLauncher
    ♥ Do have faith in what you're doing.