cubicdaiya / ngx_small_light

Dynamic Image Transformation Module For nginx.
Other
472 stars 80 forks source link

ngx_small_light didn't working on proxy_pass directive #60

Closed draskolnikova closed 8 years ago

draskolnikova commented 8 years ago

Hello!

Thanks for this awesome module, and I'm trying to creating reverse proxy to optimize images using native module from nginx.

The directive should be like this :

upstream imageserver {
        server upstream1;
        server upstream2;
        keepalive 32;
}

server {
    listen  80 default_server;
    server_name _;
    access_log  /var/log/nginx/access.log;
    error_log   /var/log/nginx/error.log;

    small_light on;
    small_light_getparam_mode on;

    location / {
        proxy_pass      http://imageserver; 
                proxy_redirect off;
                proxy_set_header Connection "";
                proxy_http_version 1.1;
                proxy_set_header Host $host;
                proxy_set_header X-Real-IP $remote_addr;
                proxy_set_header X-Forwarded-Proto $scheme;
                proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
                client_max_body_size    128m;
                client_body_buffer_size 128k;
                proxy_connect_timeout   60;
                proxy_send_timeout      60;
                proxy_read_timeout      60;
                proxy_buffers           32 4k;
    }
}

And I got error like this:

2016/08/06 15:32:55 [error] 16798#0: *20 failed to get image type ngx_http_small_light_imagemagick_init:66 while sending to client, client: 103.52.2.26, server: _, request: "GET /2015-12/cce3415441764982d1ca7b54fa2b765e.JPG HTTP/1.1", upstream: "http://[backend_ip_removed]:80/2015-12/cce3415441764982d1ca7b54fa2b765e.JPG", host: "103.52.2.19"
2016/08/06 15:32:55 [error] 16798#0: *20 failed to process image ngx_http_small_light_body_filter:387 while sending to client, client: 103.52.2.26, server: _, request: "GET /2015-12/cce3415441764982d1ca7b54fa2b765e.JPG HTTP/1.1", upstream: "http://[backend_ip_removed]:80/2015-12/cce3415441764982d1ca7b54fa2b765e.JPG", host: "103.52.2.19"
2016/08/06 15:32:55 [error] 16801#0: *21 failed to get image type ngx_http_small_light_imagemagick_init:66 while sending to client, client: 103.52.2.26, server: _, request: "GET /favicon.ico HTTP/1.1", upstream: "http://[backend_ip_removed]:80/favicon.ico", host: "103.52.2.19", referrer: "http://103.52.2.19/2015-12/cce3415441764982d1ca7b54fa2b765e.JPG"
2016/08/06 15:32:55 [error] 16801#0: *21 failed to process image ngx_http_small_light_body_filter:387 while sending to client, client: 103.52.2.26, server: _, request: "GET /favicon.ico HTTP/1.1", upstream: "http://[backend_ip_removed]:80/favicon.ico", host: "103.52.2.19", referrer: "http://103.52.2.19/2015-12/cce3415441764982d1ca7b54fa2b765e.JPG"

Is it possible?

Thank in advance. :)

cubicdaiya commented 8 years ago
2016/08/06 15:32:55 [error] 16798#0: *20 failed to get image type ngx_http_small_light_imagemagick_init:66 while sending to client, client: 103.52.2.26, server: _, request: "GET /2015-12/cce3415441764982d1ca7b54fa2b765e.JPG HTTP/1.1", upstream: "http://[backend_ip_removed]:80/2015-12/cce3415441764982d1ca7b54fa2b765e.JPG", host: "103.52.2.19"
2016/08/06 15:32:55 [error] 16798#0: *20 failed to process image ngx_http_small_light_body_filter:387 while sending to client, client: 103.52.2.26, server: _, request: "GET /2015-12/cce3415441764982d1ca7b54fa2b765e.JPG HTTP/1.1", upstream: "http://[backend_ip_removed]:80/2015-12/cce3415441764982d1ca7b54fa2b765e.JPG", host: "103.52.2.19"

Try to rename cce3415441764982d1ca7b54fa2b765e.JPG cce3415441764982d1ca7b54fa2b765e.jpg.

2016/08/06 15:32:55 [error] 16801#0: *21 failed to get image type ngx_http_small_light_imagemagick_init:66 while sending to client, client: 103.52.2.26, server: _, request: "GET /favicon.ico HTTP/1.1", upstream: "http://[backend_ip_removed]:80/favicon.ico", host: "103.52.2.19", referrer: "http://103.52.2.19/2015-12/cce3415441764982d1ca7b54fa2b765e.JPG"
2016/08/06 15:32:55 [error] 16801#0: *21 failed to process image ngx_http_small_light_body_filter:387 while sending to client, client: 103.52.2.26, server: _, request: "GET /favicon.ico HTTP/1.1", upstream: "http://[backend_ip_removed]:80/favicon.ico", host: "103.52.2.19", referrer: "http://103.52.2.19/2015-12/cce3415441764982d1ca7b54fa2b765e.JPG"

See here.

draskolnikova commented 8 years ago

@cubicdaiya oops, sorry there's a typo on extension. Thanks in a bunch!