Setting expires header to multiple locations

Edho Arief edho at myconan.net
Fri Dec 14 11:38:43 UTC 2012


On Fri, Dec 14, 2012 at 6:31 PM, howard chen <howachen at gmail.com> wrote:
> 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?
>
>

put in separate file and include it in each blocks?



More information about the nginx mailing list