I changed the location to ~ ^/static/ and the rewrite works again. I’ve
added a “expires 1w;” in this location to add an expire on all images in
/static but it doesn’t seem to apply, images give 200 OK and never
cache.
Is it the right way to do it?
Nope, since the request actually processed by your PHP handler not at
that
location.
Since it’s an fcgi, pretty sure caching directives only work with
fastcgi_cache: