nginx.conf 配置:
#user nobody;
worker_processes 1;
events {
worker_connections 1024;
}
http {
include mime.types;
default_type application/octet-stream;
#1分钟10个请求(10r/m) ,1秒2个请求(2r/s)
limit_req_zone $binary_remote_addr zone=mylimit:10m rate=10r/m;
server {
listen 81;
server_name localhost;
location / {
proxy_pass http://localhost:9280/redirect/accessUrl/;
proxy_redirect default;
#4个桶就是允许设置的时间内超过4个请求,这4个请求在第二个时间段执行,nodelay参数表示在第一个时间段内执行
limit_req zone=mylimit burst=4 nodelay;
limit_req_status 404;
}
location = /50x.html {
root html;
}
}
error_page 500 502 503 504 /50x.html;
}



