worker_processes 1;
master_process on;

error_log ./error.log debug;

load_module modules/ngx_http_limit_req_rw_module.so;

events {
    worker_connections 1024;
}

http {
    limit_req_zone $binary_remote_addr zone=one:10m rate=10r/m;
    limit_req_zone $remote_addr zone=two:10m rate=10r/s;

    limit_req_status 429;

    server {
        listen 8888;
        server_name localhost;

        location /one {
            limit_req zone=one burst=1 nodelay;
        }

        location /two {
            limit_req zone=two burst=1 nodelay;
        }
    }

    server {
        listen 9000;
        server_name localhost;

        location /api {
          limit_req_rw_handler;
        }
    }
}
