server
{
    listen 80;
    server_name xxx.com;

    location / {
        proxy_pass      http://xxx.com:8080;

        server_tokens           off;
        client_max_body_size    20m;
        proxy_set_header        Host            $host;
        proxy_set_header        X-Real-IP       $remote_addr;
        proxy_set_header        X-Forwarded-For $proxy_add_x_forwarded_for;
    }

    #生成缩略图等比例
    if ($args ~ ^r\d+x\d+$) {
        rewrite ^(.+)$ $1/$args? last;
    }
    location ~* \.(gif|png|jpg|jpeg)/r(\d+)x(\d+)$ {
        root /data/www/sezign.com;
        set $w $2;
        set $h $3;

        if ( $w = 0 ) {
                set $w '-';
        }
        if ( $h = 0 ) {
                set $h '-';
        }

        rewrite ^(.+)/r(\d+)x(\d+)$ $1 break;

        image_filter resize  $w $h;
        image_filter_buffer  10M;
    }

    #生成裁切图片固定高宽
    if ($args ~ ^c\d+x\d+$) {
        rewrite ^(.+)$ $1/$args? last;
    }
    location ~* \.(gif|png|jpg|jpeg)/c(\d+)x(\d+)$ {
        root /data/www/sezign.com;
        set $w $2;
        set $h $3;

        if ( $w = 0 ) {
                set $w '-';
        }
        if ( $h = 0 ) {
                set $h '-';
        }

        rewrite ^(.+)/c(\d+)x(\d+)$ $1 break;

        image_filter crop  $2 $h;
        image_filter_buffer  10M;
    }
}

标签: none

添加新评论