How nginx processes a TCP/UDP sessionnginx如何处理TCP/UDP会话
A TCP/UDP session from a client is processed in successive steps called phases:来自客户端的TCP/UDP会话将按称为阶段的连续步骤进行处理:
Post-accept
The first phase after accepting a client connection.接受客户端连接后的第一阶段。The ngx_stream_realip_module module is invoked at this phase.在此阶段调用ngx_stream_realip_module模块。Pre-access
Preliminary check for access.初步检查通道。The ngx_stream_limit_conn_module and ngx_stream_set_module modules are invoked at this phase.在此阶段调用ngx_stream_limit_conn_module模块和ngx_stream_set_module模块。Access
Client access limitation before actual data processing.实际数据处理之前的客户端访问限制。The ngx_stream_access_module module is invoked at this phase.在此阶段调用ngx_stream_access_module模块。SSL
TLS/SSL termination.TLS/SSL终端。The ngx_stream_ssl_module module is invoked at this phase.在此阶段调用ngx_stream_ssl_module模块。Preread
Reading initial bytes of data into the preread buffer to allow modules such as ngx_stream_ssl_preread_module analyze the data before its processing.将数据的初始字节读入preread buffer,以允许诸如ngx_stream_ssl_preread_module之类的模块在处理数据之前对其进行分析。Content
Mandatory phase where data is actually processed, usually proxied to upstream servers, or a specified value is returned to a client.强制阶段,实际处理数据,通常代理到上游服务器,或将指定值返回到客户端。Log
The final phase where the result of a client session processing is recorded.记录客户端会话处理结果的最后阶段。The ngx_stream_log_module module is invoked at this phase.在此阶段调用ngx_stream_log_module模块。