linux – Nginx limit_req_zone ip例外

前端之家收集整理的这篇文章主要介绍了linux – Nginx limit_req_zone ip例外前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。
我用:
http {
        limit_req_zone  $binary_remote_addr  zone=one:10m   rate=5r/s;
}
server {
    location ~ \.PHP${
            limit_req   zone=one  burst=2 nodelay; 
            try_files $uri $uri/ /index.PHP;
            root   /var/www/;
            fastcgi_pass   127.0.0.1:9001;
            fastcgi_index  index.PHP;
            fastcgi_param  SCRIPT_FILENAME  $document_root$fastcgi_script_name;
            include        fastcgi_params;
    }
}

如何禁用IP限制:127.0.0.1和99.99.99.99?

解决方法

geo $limited_ip {
    default      1;
    127.0.0.1    0;
    99.99.99.99  0;
}

map $limited_ip $limited_ip_key {
    0 '';
    1 $binary_remote_addr;
}

limit_req_zone $limited_ip_key zone=one:10m rate=5r/s;;

> http://nginx.org/en/docs/http/ngx_http_geo_module.html
> http://nginx.org/en/docs/http/ngx_http_map_module.html

原文链接:https://www.f2er.com/linux/397282.html

猜你在找的Linux相关文章