NGINX for the Developer
[ 184 ]
}
location @resizer {
internal;
proxy_pass http://localhost:8080$uri;
proxy_store /home/www/img$request_uri;
proxy_temp_path /home/www/tmp/proxy_temp;
}
}
server {
listen 8080;
root /home/www/img;
location ~* /resize/(?.<name>.*)_(?<width>[[:digit:]]*)
x(?<height>[[:digit:]]*)\.(?<extension>gif|jpe?g|png)$ {
error_page 404 = /resizer/$name.$extension?width=$width&heigh
t=$height;
}
location /resizer {
image_filter resize $arg_width $arg_height;
}
}
As you can see in the table of directives for the image_filter module, any error
returned by this module has the code 415. We can catch this error to replace it with
an empty GIF, so that the end user will still get an image instead of an error message:
location /thumbnail {
image_filter resize 90 90;
error_page 415 = @empty;
}