【发布时间】:2014-08-22 00:35:01
【问题描述】:
我正在尝试通过 openresty 使用 nginx 为某个 uri 设置全局限制
使用以下配置,如果我卷曲此框,无论我每分钟请求多少次,我都会得到 204。 worker_processes 1; error_log 日志/error.log;
events {
}
http {
log_format spec_format '$request_uri $const $status';
access_log logs/access.log spec_format;#off;
resolver 10.0.0.2;
limit_req_log_level error;
limit_req_zone $const zone=one:100k rate=1r/m;
server {
set $const 1;
listen 80;
location / {
return 200 "invalid url";
}
location ~* /request/? {
limit_req zone=one burst=1 nodelay;
return 204;
}
location /health/ {
return 200 "healthy";
}
}
}
从文档中我找不到任何明显的东西(我尝试过很多次切换)。
如果有帮助,该机器在 EIP 和 Ubuntu 13.10 后面的 AWS 上运行。我正在使用来自 openresty.org 的 openresty-1.5.8.1。
另外,我想要工作的实际限制是大约 24000r/s,并且我认为还有其他设置可能会发生冲突,但即使将其剥离也不会像我认为的那样运行。
【问题讨论】:
标签: nginx