заголовок Accept-Encoding и -f mod_rewrite

Roxis roxis at list.ru
Sat Mar 3 17:12:20 MSK 2007


On Saturday 03 March 2007, Александр Ворона wrote:
> Alexey Rymonin пишет:
> >     if (!-f $wwwroot$request_uri.gz) {
> >        rewrite  ^(.*)$  $1.gz  last;
> >     }
>
> Например так
> set $mydocroot /var/www/$my_domain/web;
> .....
> root $mydocroot;
> if (!-f $mydocroot$request_uri.gz) {
> .....

    location ~ \.html?$ {
        if ($http_accept_encoding !~ gzip) {
            break;
        }
        if ( !-f $document_root$uri.gz) {
            break;
        }

        rewrite ^(.+)$ $1.gz last;
    }

    location ~ \.gz$ {
        default_type text/html;
        add_header Content-Encoding gzip;
    }






More information about the nginx-ru mailing list