ngx_cookie_limit_req_module - nginx cookie 访问限制模块


GPL
跨平台
C/C++

软件简介

此模块不仅限制cookie的访问速率,而且还限制恶意IP伪造cookie的数量。

cd redis-4.0**version**/deps/hiredis
make 
make install 
echo /usr/local/lib >> /etc/ld.so.conf
ldconfig

cd nginx-**version**
./configure --add-module=/path/to/this/ngx_cookie_limit_req_module 
make
make install

配置模板

    worker_processes  2;
    events {
        worker_connections  1024;
    }
    http {
        include       mime.types;
        default_type  application/octet-stream;
        sendfile        on;
        keepalive_timeout  65;

cookie_limit_req_zone $http_cookie zone=two:10m rate=30r/s redis=127.0.0.1 block_second=300 cookie_max=5;
cookie_limit_req zone=two burst=30 nodelay;
cookie_limit_req_status 403;



        server {
            listen       80;
            server_name  localhost;
            location / {
                root   html;
                index  index.html index.htm;
            }
            error_page   403 500 502 503 504  /50x.html;
            location = /50x.html {
                root   html;
            }
        }
    }