Re: resize image как задать переменную, если ее нет в аргументах

cilrill nginx-forum at nginx.us
Wed Jun 17 06:03:30 UTC 2015


спасибо.

вылезла не понятная мне проблема (
завел переменные с проверкой

server {
        listen 80;
        server_name static.vhost static.vhost2;

        location ~ ^/(.*\.(?:jpg|gif|png))$ {
        alias /home/$host$uri;
        set $q 75;
        if ($arg_q) {
        set $q $arg_q;
        }
        if ($arg_s) {
        set $s $arg_s;
        }
        image_filter resize $s -;
        image_filter_jpeg_quality $q;
        access_log /var/log/nginx/access.img.log;
        error_page      415 = @images;
        }

        location @images {
        root /home/$host;
        }
}

развалилось )

в дебаге вот такое

2015/06/17 05:06:27 [debug] 818#0: *105 content phase: 22
2015/06/17 05:06:27 [debug] 818#0: *105 http script copy: "/home/"
2015/06/17 05:06:27 [debug] 818#0: *105 http script var: "static.vhost"
2015/06/17 05:06:27 [debug] 818#0: *105 http script var: "/bg.png"
2015/06/17 05:06:27 [debug] 818#0: *105 http filename:
"/home/static.vhost/bg.png1.1
Host"
2015/06/17 05:06:27 [debug] 818#0: *105 add cleanup: 00000000010BE2C0
2015/06/17 05:06:27 [error] 818#0: *105 open() "/home/stati" failed (2: No
such file or directory), client: 172.17.42.1, server: static.vhost, request:
"GET /bg.png?s=280&q=20 HTTP/1.1", host: "static.vhost"
2015/06/17 05:06:27 [debug] 818#0: *105 http finalize request: 404,
"/bg.png?s=280&q=20" a:1, c:1
2015/06/17 05:06:27 [debug] 818#0: *105 http special response: 404,
"/bg.png?s=280&q=20"
2015/06/17 05:06:27 [debug] 818#0: *105 http set discard body
2015/06/17 05:06:27 [debug] 818#0: *105 uploadprogress error-tracker error:
404
2015/06/17 05:06:27 [debug] 818#0: *105 uploadprogress error-tracker not
tracking in this location
2015/06/17 05:06:27 [debug] 818#0: *105 http output filter
"/bg.png?s=280&q=20"
2015/06/17 05:06:27 [debug] 818#0: *105 http copy filter:
"/bg.png?s=280&q=20"
2015/06/17 05:06:27 [debug] 818#0: *105 image filter
2015/06/17 05:06:27 [debug] 818#0: *105 image filter: "<h"
2015/06/17 05:06:27 [debug] 818#0: *105 http special response: 415,
"/bg.png?s=280&q=20"
2015/06/17 05:06:27 [debug] 818#0: *105 http set discard body
2015/06/17 05:06:27 [debug] 818#0: *105 uploadprogress error-tracker error:
415
2015/06/17 05:06:27 [debug] 818#0: *105 uploadprogress error-tracker not
tracking in this location
2015/06/17 05:06:27 [debug] 818#0: *105 xslt filter header
2015/06/17 05:06:27 [debug] 818#0: *105 HTTP/1.1 415 Unsupported Media Type


" http filename: "/home/static.vhost/bg.png1.1
Host""

что странно, при использовании в image_filter $arg_s и
image_filter_jpeg_quality $arg_q (при заданных агрументах) путь формируется
правильно.

я не правильно пути для alias формирую?

Posted at Nginx Forum: http://forum.nginx.org/read.php?21,259674,259676#msg-259676



Подробная информация о списке рассылки nginx-ru