redirects log

Igor Sysoev is at rambler-co.ru
Wed Sep 16 16:16:57 MSD 2009


On Wed, Sep 16, 2009 at 07:32:28AM -0400, cat wrote:

> Здравствуйте, дорогая редакция.
> так сложилось, что мне необходимо банить запросы на сервер по параметру из query string.
> на данный момент это выглядит так:
> 
> 
> server
>         {
>                 listen 80;
>                 ....
>                 if ($arg_IP = 192.168.1.2){rewrite ^ /banned.html;}
>                 if ($arg_IP = 192.168.1.3){rewrite ^ /banned.html;}
>                 if ($arg_IP = ... ){rewrite ^ /banned.html;}
>                ......
>           }
> 
> 
> единственное, чего мне не хватает - логи доступа с забаненных IP.

http {

    geo $banned {
        default      0
        192.168.1.2  1;
        192.168.1.3  1;
        ...
    }

    server {
        if ($banned) {
            rewrite  ^ /banned.html;
        }

        location = /banned.html {
            access_log  /path/to/banned;
        }

        ...
    }

> log_subrequest on;
> 
> The directive enables or disables messages in access_log about sub-requests such as rewrite rules and/or SSI requests. 
> включил, но ничего нового в логах не нашел.

log_subrequest относится только к SSI requests и не имеют отношения к
rewritted requests.


-- 
Игорь Сысоев
http://sysoev.ru





More information about the nginx-ru mailing list