Setting expires header to multiple locations

howard chen howachen at gmail.com
Fri Dec 14 11:31:41 UTC 2012


Currently I need to use tricks since I have multiple locations in my site
config.

e.g.

=====================================


location ~* /a {
    location ~* ^/.*\.(?:css|js|jpg|jpeg|gif|png)$ {
        expires 1y;
    }
}

location ~* /b {
    location ~* ^/.*\.(?:css|js|jpg|jpeg|gif|png)$ {
        expires 1y;
    }
}

location ~* /c {
    location ~* ^/.*\.(?:css|js|jpg|jpeg|gif|png)$ {
        expires 1y;
    }
}


=====================================

Are there any better way to write it?


Thanks.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.nginx.org/pipermail/nginx/attachments/20121214/e03c93b1/attachment.html>


More information about the nginx mailing list