[转帖]Module ngx_http_v2_module

module,ngx,http,v2 · 浏览次数 : 0

小编点评

**nginx_http_v2_module Documentation** This module provides support for HTTP/2. It requires the **--with-http_v2_module** configuration parameter to be enabled. **Configuration Options:** * **http2_max_requests**: Specifies the maximum number of requests that can be served through one HTTP/2 connection. (Default: 1000) * **http2_max_concurrent_streams**: Specifies the maximum number of concurrent HTTP/2 streams that can be handled. (Default: 128) * **http2_max_field_size**: Specifies the maximum size of the entire request header list after HPACK compression. (Default: 4k) * **http2_max_header_size**: Specifies the maximum size of the entire request header list. (Default: 16k) * **http2_keepalive_requests**: Specifies the maximum number of requests that can be served through one HTTP/2 connection before the next client request leads to connection closing. (Default: 1000) * **http2_push**: Specifies whether to enable automatic conversion of preload links into push requests. (Default: off) * **http2_recv_buffer_size**: Specifies the size of the per-worker input buffer. (Default: 256k) * **http2_recv_timeout**: Specifies the timeout for expecting more data from the client after which the connection is closed. (Default: 30s) * **http2_client_header_timeout**: Specifies the timeout for expecting more data from the client after which the connection is closed. (Default: 30s) **Note:** Some of these options may be obsolete or deprecated, depending on the nginx version.

正文

https://nginx.org/en/docs/http/ngx_http_v2_module.html#:~:text=Sets%20the%20maximum%20number%20of%20concurrent%20HTTP%2F2%20streams,limit%20applies%20equally%20to%20both%20name%20and%20value.

 

Known Issues
Example Configuration
Directives
     http2
     http2_body_preread_size
     http2_chunk_size
     http2_idle_timeout
     http2_max_concurrent_pushes
     http2_max_concurrent_streams
     http2_max_field_size
     http2_max_header_size
     http2_max_requests
     http2_push
     http2_push_preload
     http2_recv_buffer_size
     http2_recv_timeout
Embedded Variables

The ngx_http_v2_module module (1.9.5) provides support for HTTP/2.

This module is not built by default, it should be enabled with the --with-http_v2_module configuration parameter.

Known Issues

Before version 1.9.14, buffering of a client request body could not be disabled regardless of proxy_request_bufferingfastcgi_request_bufferinguwsgi_request_buffering, and scgi_request_buffering directive values.

Before version 1.19.1, the lingering_close mechanism was not used to control closing HTTP/2 connections.

Example Configuration

 

server {
    listen 443 ssl;

    http2 on;

    ssl_certificate server.crt;
    ssl_certificate_key server.key;
}

Note that accepting HTTP/2 connections over TLS requires the “Application-Layer Protocol Negotiation” (ALPN) TLS extension support, which is available since OpenSSL version 1.0.2.

Also note that if the ssl_prefer_server_ciphers directive is set to the value “on”, the ciphers should be configured to comply with RFC 9113, Appendix A black list and supported by clients.

Directives

Syntax: http2 on | off;
Default:
http2 off;
Context: httpserver

This directive appeared in version 1.25.1.

Enables the HTTP/2 protocol.

Syntax: http2_body_preread_size size;
Default:
http2_body_preread_size 64k;
Context: httpserver

This directive appeared in version 1.11.0.

Sets the size of the buffer per each request in which the request body may be saved before it is started to be processed.

Syntax: http2_chunk_size size;
Default:
http2_chunk_size 8k;
Context: httpserverlocation

Sets the maximum size of chunks into which the response body is sliced. A too low value results in higher overhead. A too high value impairs prioritization due to HOL blocking.

Syntax: http2_idle_timeout time;
Default:
http2_idle_timeout 3m;
Context: httpserver

 

This directive is obsolete since version 1.19.7. The keepalive_timeout directive should be used instead.

 

Sets the timeout of inactivity after which the connection is closed.

Syntax: http2_max_concurrent_pushes number;
Default:
http2_max_concurrent_pushes 10;
Context: httpserver

This directive appeared in version 1.13.9.

 

This directive is obsolete since version 1.25.1.

 

Limits the maximum number of concurrent push requests in a connection.

Syntax: http2_max_concurrent_streams number;
Default:
http2_max_concurrent_streams 128;
Context: httpserver

Sets the maximum number of concurrent HTTP/2 streams in a connection.

Syntax: http2_max_field_size size;
Default:
http2_max_field_size 4k;
Context: httpserver

 

This directive is obsolete since version 1.19.7. The large_client_header_buffers directive should be used instead.

 

Limits the maximum size of an HPACK-compressed request header field. The limit applies equally to both name and value. Note that if Huffman encoding is applied, the actual size of decompressed name and value strings may be larger. For most requests, the default limit should be enough.

Syntax: http2_max_header_size size;
Default:
http2_max_header_size 16k;
Context: httpserver

 

This directive is obsolete since version 1.19.7. The large_client_header_buffers directive should be used instead.

 

Limits the maximum size of the entire request header list after HPACK decompression. For most requests, the default limit should be enough.

Syntax: http2_max_requests number;
Default:
http2_max_requests 1000;
Context: httpserver

This directive appeared in version 1.11.6.

 

This directive is obsolete since version 1.19.7. The keepalive_requests directive should be used instead.

 

Sets the maximum number of requests (including push requests) that can be served through one HTTP/2 connection, after which the next client request will lead to connection closing and the need of establishing a new connection.

Closing connections periodically is necessary to free per-connection memory allocations. Therefore, using too high maximum number of requests could result in excessive memory usage and not recommended.

Syntax: http2_push uri | off;
Default:
http2_push off;
Context: httpserverlocation

This directive appeared in version 1.13.9.

 

This directive is obsolete since version 1.25.1.

 

Pre-emptively sends (pushes) a request to the specified uri along with the response to the original request. Only relative URIs with absolute path will be processed, for example:

http2_push /static/css/main.css;

The uri value can contain variables.

Several http2_push directives can be specified on the same configuration level. The off parameter cancels the effect of the http2_push directives inherited from the previous configuration level.

Syntax: http2_push_preload on | off;
Default:
http2_push_preload off;
Context: httpserverlocation

This directive appeared in version 1.13.9.

 

This directive is obsolete since version 1.25.1.

 

Enables automatic conversion of preload links specified in the “Link” response header fields into push requests.

Syntax: http2_recv_buffer_size size;
Default:
http2_recv_buffer_size 256k;
Context: http

Sets the size of the per worker input buffer.

Syntax: http2_recv_timeout time;
Default:
http2_recv_timeout 30s;
Context: httpserver

 

This directive is obsolete since version 1.19.7. The client_header_timeout directive should be used instead.

 

Sets the timeout for expecting more data from the client, after which the connection is closed.

Embedded Variables

The ngx_http_v2_module module supports the following embedded variables:

$http2
negotiated protocol identifier: “h2” for HTTP/2 over TLS, “h2c” for HTTP/2 over cleartext TCP, or an empty string otherwise.

与[转帖]Module ngx_http_v2_module相似的内容:

[转帖]Module ngx_http_v2_module

https://nginx.org/en/docs/http/ngx_http_v2_module.html#:~:text=Sets%20the%20maximum%20number%20of%20concurrent%20HTTP%2F2%20streams,limit%20applies%20

[转帖]NGINX的一些SEO优化常用配置

https://www.jianshu.com/p/e55073e5ebc7 官方文档:http://nginx.org/en/docs/ 常用模块: ngx_http_core_module ngx_http_rewrite_module ngx_http_proxy_module ngx_htt

[转帖]Nginx 负载均衡 和 健康检查

https://www.jianshu.com/p/fbb0a81604d9 简介 从 nginx 下载, 到模块安装 关于为什么不使用 ngx_http_upstream_module 测试过 ngx_http_upstream_module 这个模块, 在应用稳定的情况下做做负载均衡还可以. 但

[转帖]Nginx之ngx_http_realip_module

https://www.jianshu.com/p/80a779b3bf20 问题描述 今日在线上查询nginx日志文件的用户真实IP时,发现remote_addr和XFF地址一模一样,这点让我很是不理解,正常来讲remote_addr应该获取到的是上一个节点转发的IP地址,我们却是获得了用户的真实

[转帖]nginx的map指令

一 ngx_http_map_module模块 1) map 指令是由 'ngx_http_map_module 模块'提供的,默认情况下安装 nginx 都会'安装'该模块. 2) map 的主要作用是'创建自定义变量',通过使用 nginx 的'内置'变量,去'匹配'某些特定规则;如果匹配成功则

[转帖]最新版nginx内置变量

在配置基于nginx服务器的网站时,必然会用到 nginx内置变量 ,下面笔者将它整理成列表,把最新版本的变量列出来,以方便做配置时查询 nginx内置变量 内置变量存放在 ngx_http_core_module 模块中,变量的命名方式和apache 服务器变量是一致的。总而言之,这些变量代表着客

[转帖]Ngx_lua

http://me.52fhy.com/lua-book/chapter12.html 简介 ngx_lua 指的是 lua-nginx-module模块:通过将 LuaJIT 的虚拟机嵌入到 Nginx 的 worker 中,这样既保持高性能,又能不失去lua开发的简单特性。 OpenResty 

[转帖]nginx的ip_hash算法

概念 根据用户请求的ip,利用算法映射成hash值,分配到特定的tomcat服务器中。主要是为了实现负载均衡,只要用户ip固定,则hash值固定,特定用户只能访问特定服务器,解决了session的问题。 源码分析 ip_hash算法的处理代码位于src\http\modules\ngx_http_u

[转帖]Spring Boot 3 Ships November 2022, Delays Java Module Support

Spring Boot 3 Ships November 2022, Delays Java Module Supporthttps://www.infoq.com/news/2022/10/spring-boot-3-jax-london/ Join a community of experts.

[转帖]超详细的解决ModuleNotFoundError: No module named '_curses'错误的方法!!!

超详细的解决ModuleNotFoundError: No module named '_curses’的错误 问题描述:在写py脚本时,需要用到curses库(提供了控制字符屏幕的独立于终端的方法)。 导入的时候完全正常 Run的时候却报了这样的错误(它说找不到这个包) 本能的解决方法: 首先想到