Nginx Browser Caching using HTTP Headers outside server/location block
- by Danny O'Sullivan
I am having difficulty setting the HTTP expires headers for Nginx outside of specific server (and then location) blocks. What I want is to something like the following:
location ~* \.(png|jpg|jpeg|gif|ico)$ {
expires 1y;
}
But not have to repeat it in every single server block, because I am hosting a large number of sites. I can put it in…