虽然spdy 协议早已被 HTTP2 取代,但是chrome 旧浏览器和 移动端基于chrome内核的应用还是挺多的,所以spdy 的兼容还是必要的
cloudflare 出了个spdy的补丁,可以兼容HTTP2和SPDY
https://blog.cloudflare.com/open-sourcing-our-nginx-http-2-spdy-code/
靠谱补丁 for nginx 1.10.3:
https://github.com/cujanovic/nginx-http2-spdy-patch/blob/master/nginx-spdy.patch
一般靠谱补丁:
https://github.com/cloudflare/sslconfig/tree/master/patches
打完补丁后, build的时候增加编译参数即可
–with-http_spdy_module #开启spdy 协议, 需要打上cloudflare的patch
–with-http_v2_module #开启HTTP2 协议,不需要任何补丁
nginx 相关配置可以参考nginx 配置文档
server {
listen 443 spdy http2;
…
}