Skip to content

Commit 7957b1c

Browse files
committed
添加http2.0配置说明
1 parent 1f069b2 commit 7957b1c

File tree

3 files changed

+42
-2
lines changed

3 files changed

+42
-2
lines changed

README.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,10 +22,11 @@
2222
- [ip_hash支持基于主机号hash](https://blog.csdn.net/yswKnight/article/details/107180893)
2323
- [开启nginx dump](https://github.com/trimstray/nginx-admins-handbook/blob/master/doc/RULES.md#beginner-use-core-dumps-to-figure-out-why-nginx-keep-crashing)
2424
- 内置ssl生成工具
25-
- 样例
25+
- 使用样例
2626
- [x] [ssl配置](book/02配置样例/01ssl配置样例.md)
2727
- 调优列表
2828
- [x] [worker数量](book/03配置调优/01worker数量调优.md)
29+
- [ ] [使用HTTP2](book/03配置调优/02使用HTTP2.md)
2930

3031
### 构建介质
3132

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
## 使用HTTP2.0
2+
3+
> `HTTP/2`将使我们的应用程序更快、更简单、更健壮:
4+
5+
`HTTP/2`的主要目标是通过启用完整的请求和响应多路复用来减少延迟,
6+
通过`HTTP`报头字段的有效压缩来最小化协议开销,
7+
并增加对请求优先级和服务器推送的支持。
8+
`HTTP/2`也有一个非常大的旧的和不安全的密码黑名单。
9+
10+
> `http2`指令配置端口接受`HTTP/2`连接
11+
12+
`HTTP/2`向后兼容`HTTP/1.1`,如果客户端不支持`HTTP/2`,那么`nginx`与客户端间通信将采用`HTTP/1`协议
13+
14+
配置样例
15+
16+
```nginx configuration
17+
server {
18+
...
19+
listen 8081 http2;
20+
...
21+
}
22+
```
23+
24+
`HTTP/2`在一个单一的`TCP`连接复用多个`http`请求,通常情况当服务端使用`HTTP/2`时,客户端将建立单个`TCP`连接与服务端通信。
25+
26+
> 开启`HTTP/2`的同时应开启`ssl`
27+
28+
因为绝大多数情况下,浏览器不支持没有加密的`HTTP/2`(尽管`h2`规范中允许使用`HTTP/2`在一个不安全的`http://`,
29+
即没有加密证书的情况。但是浏览器没有实现(大多数浏览器并不打算))。
30+
31+
注意:通过`TLS`接受`HTTP/2`连接需要`应用层协议协商`(ALPN) `TLS`扩展支持。
32+
33+
```nginx configuration
34+
server {
35+
36+
listen 10.240.20.2:443 ssl http2;
37+
38+
...
39+
```

book/优秀文档/为什么nginx一个worker可以承担所有的负载.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
![原文地址](https://blog.cloudflare.com/the-sad-state-of-linux-socket-balancing/)
1+
[原文地址](https://blog.cloudflare.com/the-sad-state-of-linux-socket-balancing/)
22

33
### 单核下运行nginx的一些挑战
44

0 commit comments

Comments
 (0)