ngx_http_limit_req_module模块
生效阶段:NGX_HTTP_PREACCESS_PHASE阶段
模块:http_limit_req_module
默认编译进nginx,通过--without-http_limit_req_module来禁用
生效算法:leaky bucket算法
生效范围:
(1)全部worker进程(基于共享内存)
(2) 进入preaccess阶段前不生效
1.limit_conn_log_level指令(限制发生时的日志级别)
limit_conn_log_level info|notice|warn|error
默认limit_conn_log_level error
放置位置:http,server,location
2.limit_conn_status 指令(限制发生时向客户端返回的错误码)
limit_conn_status code
默认:limit_conn_status 503
本文详细介绍了Nginx的ngx_http_limit_req_module模块,该模块基于leakybucket算法在NGX_HTTP_PREACCESS_PHASE阶段对请求进行限流。文章解释了如何通过limit_conn_log_level和limit_conn_status指令配置限流时的日志级别和返回错误码,适用于所有worker进程。
1634

被折叠的 条评论
为什么被折叠?



