nginx支持http2

前提

  1. nginx  >= 1.9.14
  2. openssl >= 1.0.2

编译

./configure --with-http_v2_module --with-openssl=/home/app/openssl-1.0.2o --with-debug

新增--with-http_v2_module --with-openssl=/home/app/openssl-1.0.2o编译指令,注意with-openssl 为openssl的源代码目录。

若工程遵循nginx的开发模式,且具备config配置文件,nginx会将该源代码编译成模块,并链接到自身的二进制可执行文件中。

配置

listen 指令中增加http2

 

http2 标准并没有规定使用https,但是现行的浏览器不支持没有加密的http2,所以使用https成了事实标准。

验证

http://nginx.org/en/docs/http/ngx_http_v2_module.html

猜你喜欢

转载自www.cnblogs.com/nginx-core/p/9055161.html