NGINX上的图像重写

NGINX上的图像重写,nginx,Nginx,我在nginx上有一个应用程序。链接到我们网站上的图像的网站,我们需要将其重写为新图像: From: /static/v20/images/lorem/ipsum/square6.png To: /static/v31/images/ipsum/example/square8.png 这就是我所尝试的: rewrite ^/static/(.*)/images/lorem/ipsum/(.*).png /static/v31/images/ipsum/example/$2.png;

我在nginx上有一个应用程序。链接到我们网站上的图像的网站,我们需要将其重写为新图像:

From: /static/v20/images/lorem/ipsum/square6.png
To: /static/v31/images/ipsum/example/square8.png
这就是我所尝试的:

rewrite ^/static/(.*)/images/lorem/ipsum/(.*).png
    /static/v31/images/ipsum/example/$2.png;
我怎么能做到

谢谢大家!

rewrite ^/static/(?:.+)/images/lorem/ipsum/(.+)\.png$
         /static/v31/images/ipsum/example/$1.png;