如何配置nginx http图像过滤器模块?



我有两台服务器,需要配置nginx http_image_filter模块。

第一个服务器配置:

server {
listen 80;
server_name image.site.com;
access_log      /var/log/nginx/image.site.com-access.log;
error_log       /var/log/nginx/image.site.com-error.log;

location / {
proxy_pass http://192.168.1.4;
}
}

192.168.1.4 上的配置是:

server {
listen 80;
server_name image.site.com;
access_log      /var/log/nginx/image.site.com-access.log;
error_log       /var/log/nginx/image.site.com-error.log;
root /home/zulu/img/RU/;
location ~ "/img/RU/(.*[^0-9])([0-9]+)x([0-9]+).png$" {
set $image $1;
set $width $2;
set $height $3;
image_filter resize $width $height;
}
}

当我去 image.site.com/img/RU/image.png 时它不起作用

我做错了什么?

这是正确的配置:

代理

server {
listen 80;
server_name image.site.com;
access_log      /var/log/nginx/image.site.com.log;
error_log       /var/log/nginx/image.site.com-error.log;
location / {
proxy_pass http://192.168.151.4;
}
proxy_cache images;
proxy_cache_lock on;
proxy_cache_valid 30d;
proxy_cache_use_stale error timeout invalid_header updating;
expires 30d;
}

和图像服务器

server {
listen 80;
server_name image.site.com;
access_log      /var/log/nginx/image.site.com.log;
error_log       /var/log/nginx/image.site.com-error.log;
root /var/www/files/update/ServiceLogo/;
image_filter_buffer 50M;
location ~ ^/(?<width>d+)x(?<height>d+)/(?<name>.*)$ {
image_filter resize $width $height;
alias /var/www/files/update/ServiceLogo/$name;
}
location ~ ^/c/(?<width>d+)x(?<height>d+)/(?<name>.*)$ {
image_filter crop $width $height;
alias /var/www/files/update/ServiceLogo/$name;
}
location ~ ^/users/(?<width>d+)x(?<height>d+)/(?<name>.*)$ {
image_filter resize $width $height;
alias /var/www/files/update/personDocs/$name;
}
location ~ ^/cusers/(?<width>d+)x(?<height>d+)/(?<name>.*)$ {
image_filter crop $width $height;
alias /var/www/files/update/personDocs/$name;
}
}