Nginx http2.0
109/110
HTTP2.0协议 优势必须使用TLS加密
传输数据量大幅减少 1:以二进制格式传输 2:标头压缩(header做压缩)
多路复用及相关功能 : 消息优先级 (比如样式表先渲染页面那么这个css样式表优先级就高,图片呈现可以慢些就优先级低些)
服务器消息推送 : 并行推送(server-client)主动推消息
首先要编译进SSL --with-http_ssl_module 和 --with-http_v2_module
Nginx如何推送资源 目前必须支持SSL
http2_push_preload指令由header指定推送那些内容
syntax : http2_push_preload on|off
default : off
context : http,server,location
http2_push 指令是由Nginx的配置文件来决定向客户端推送文件
1: 安装 yum install nghttp2
下面看下配置文件
location /{
root tmp_html;
http2_push /a.txt; #这里针对tmp_html目录下主动推送a.txt
}
listen ssl http2 ; # 在证书后面加 http2
然后用 nghttp2 命令查询推送数据
nghttp -ns https://shop**.com.cn
返回结果
***** Statistics *****
Request timing:
responseEnd: the time when last byte of response was received
relative to connectEnd
requestStart: the time just before first byte of request was sent
relative to connectEnd. If '*' is shown, this was
pushed by server.
process: responseEnd - requestStart
code: HTTP status code
size: number of bytes received as response body without
inflation.
URI: request URI
see http://www.w3.org/TR/resource-timing/#processing-model
sorted by 'complete'
id responseEnd requestStart process code size request path
13 +1.75ms +149us 1.60ms 200 4K /
2 +1.79ms * +558us 1.23ms 200 27 /a.txt 我们看到 a.txt被推送过来了
| Syntax: | http2_max_concurrent_pushes |
|---|---|
| Default: |
http2_max_concurrent_pushes 10; |
| Context: | http, server |
| Syntax: | http2_recv_timeout |
|---|---|
| Default: |
http2_recv_timeout 30s; |
| Context: | http, server |
| Syntax: | http2_idle_timeout |
|---|---|
| Default: |
http2_idle_timeout 3m; |
| Context: | http, server |
| Syntax: | http2_max_concurrent_streams |
|---|---|
| Default: |
http2_max_concurrent_streams 128; |
| Context: | http, server |
| Syntax: | http2_max_field_size |
|---|---|
| Default: |
http2_max_field_size 4k; |
| Context: | http, server |
| Syntax: | http2_max_requests |
|---|---|
| Default: |
http2_max_requests 1000; |
| Context: | http, server |
Syntax:http2_chunk_size size; 用于chunk分离的时候每个chunk的大小
Default:
http2_chunk_size 8k;
Context:http, server, location
| Syntax: | http2_recv_buffer_size |
|---|---|
| Default: |
http2_recv_buffer_size 256k; |
| Context: | http |
| Syntax: | http2_max_header_size |
|---|---|
| Default: |
http2_max_header_size 16k; |
| Context: | http, server |
| Syntax: | http2_body_preread_size |
|---|---|
| Default: |
http2_body_preread_size 64k; |
| Context: | http, server |
Nginx http2.0的更多相关文章
- nginx编译支持HTTP2.0
nginx编译支持HTTP2.0 nginx编译支持HTTP2.0 wget https://www.openssl.org/source/openssl-1.1.0i.tar.gz #openssl ...
- HTTP2.0学习 与 Nginx和Tomcat配置HTTP2.0
目录 一.HTTP2.0 1.1 简介 1.2 新的特性 1.3 h2c 的支持度 二.Nginx 对 http2.0 的支持 2.1 Nginx 作为服务端使用http2.0 2.2 Nginx 作 ...
- 既有Nginx重新动态编译增加http2.0模块
1.HTTP2.0 HTTP2.0相较于http1.x,大幅度的提升了web性能,在与http1.1完全语义兼容的基础上,进一步减少了网络延时.我们现在很多对外的网站都采用https,但是F12一下看 ...
- HTTP,HTTP2.0,SPDY,HTTPS你应该知道的一些事
作为一个经常和web打交道的程序员,了解这些协议是必须的,本文就向大家介绍一下这些协议的区别和基本概念,文中可能不局限于前端知识,还包括一些运维,协议方面的知识,希望能给读者带来一些收获,如有不对之处 ...
- HTTP2.0那些事
1. HTTP2.0的前世 http2.0的前世是http1.0和http1.1这两兄弟.虽然之前仅仅只有两个版本,但这两个版本所包含的协议规范之庞大,足以让任何一个有经验的工程师为之头疼.http1 ...
- HTTP2.0和QUIC
最近看到腾讯云支持QUIC的文章,突然意识到还没有好好认识HTTP2.QUIC,而要认识HTTP2,就需要从HTTP1.0开始讲起,才能清楚HTTP的发展历程. HTTP1.x HTTP(HyperT ...
- HTTP1.0、HTTP1.1 和 HTTP2.0 的区别
一.HTTP的历史 早在 HTTP 建立之初,主要就是为了将超文本标记语言(HTML)文档从Web服务器传送到客户端的浏览器.也是说对于前端来说,我们所写的HTML页面将要放在我们的 web 服务器上 ...
- 杂谈:HTTP1.1 与 HTTP2.0 知多少?
HTTP是应用层协议,是基于TCP底层协议而来. TCP的机制限定,每建立一个连接需要3次握手,断开连接则需要4次挥手. HTTP协议采用"请求-应答"模式,HTTP1.0下,HT ...
- HTTP2.0探究
http1.1和http2.0在请求379张图片的对比演示(HTTP2.0性能惊人). HTTP2.0是HTTP协议自1999年HTTP1.1发布后的首个更新,主要基于SPDY(读speedy). ...
随机推荐
- Linux进程管理 (2)CFS调度器
关键词: 目录: Linux进程管理 (1)进程的诞生 Linux进程管理 (2)CFS调度器 Linux进程管理 (3)SMP负载均衡 Linux进程管理 (4)HMP调度器 Linux进程管理 ( ...
- face recognition[Euclidean-distance-based loss][FaceNet]
本文来自<FaceNet: A Unified Embedding for Face Recognition and Clustering>.时间线为2015年6月.是谷歌的作品. 0 引 ...
- element-ui中 table表格hover 修改背景色
增加样式级别就行啦 .el-table--enable-row-hover .el-table__body tr:hover>td{ background-color: #212e3e !i ...
- 【开源】小程序、小游戏和Web运动引擎 to2to 发布
简单轻量跨平台的 Javascript 运动引擎 Github → https://github.com/dntzhang/cax/tree/master/packages/to Simple DEM ...
- 朱晔和你聊Spring系列S1E5:Spring WebFlux小探
阅读PDF版本 本文会来做一些应用对比Spring MVC和Spring WebFlux,观察线程模型的区别,然后做一下简单的压力测试. 创建一个传统的Spring MVC应用 先来创建一个新的web ...
- Jvm 参数笔记
Jvm参数含义 https://cloud.tencent.com/developer/article/1129474 从一道题说起 https://blog.csdn.net/crazylzxlzx ...
- Bean笔记
为什么需要Bean , 因为 Aop 需要. 顺序 InstantiationAwareBeanPostProcessor , BeanPostProcessor 每个Bean都会执行这两个组件的相关 ...
- 后台管理系统之邮件开发(Java实现)
一,功能点 后台管理系统,添加用户时.对注册的新用户邮箱发送初始密码. 二,代码实现 1.Mail实体类 public class Mail { private Set<String> r ...
- CentOS云厂商清单
Download CentOShttps://www.centos.org/download/ Download - CentOS Wikihttps://wiki.centos.org/Downlo ...
- Linux watchdog
使用 watchdog 构建高可用性的 Linux 系统及应用https://www.ibm.com/developerworks/cn/linux/l-cn-watchdog/index.html ...