Re: Adding expires on all images break nginx rewrite

Thanks for the reply Nurahmadie.

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?

location ~ ^/static/ {
rewrite ^/static/images/([0-9])-([0-9]+)x([0-9]+)/(.*)$
/image-fa013d.php?zc=$1&w=$2&h=$3&src=…/uploads/images/$4;
expires 1w;
}

Kind regards,

Karl

On Tue, Mar 17, 2015 at 2:02 PM, Nurahmadie Nurahmadie
<[email protected]

On Wed, Mar 18, 2015 at 3:46 AM, Karl J. [email protected]
wrote:

    expires 1w;

}

Kind regards,

Karl

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:

http://nginx.org/en/docs/http/ngx_http_fastcgi_module.html#fastcgi_cache_valid

Yes that’s what I understood after few tests. I will add the expire by
the
PHP script.

Thanks for all the help!

Karl

On Tue, Mar 17, 2015 at 3:07 PM, Nurahmadie Nurahmadie
<[email protected]