NginX MIME expires
Prior version 1.7.9 the only way to set expires on content was
usage of dedicated location on file extension, which was clumpsy
and collided with other locations time to time.
Now we can use map to define expires based on MIME type:
map $sent_http_content_type $expires {
default off;
~image/ 1d;
~text/ 1h;
application/x-javascript 1h;
}
Then we simply handle $expires variable to expires statement:
server {
# ...
expires $expires;
}
And that's all. This way it doen't matter, if content is handled from the file system or some other backend. Exprires are always set as desired.