Following nginx configuration in a server block can cache js and css
files
with “js” or “css” as the end of the url.
location ~ .*\.(js|css)?$ {
expires 7d;
}
But it can’t cache request such as:
http: //example.com/jquery.js?ver=1.11.3&build=1
or
http: //example.com/style.css?ver=4.3&build=1
Any way to cache cs/jss files above? Or cache files based on the file
type
of request instead of file name?
Posted at Nginx Forum:
http://forum.nginx.org/read.php?2,261338,261338#msg-261338
log
#2
Please try to remove $ in the end of the expression:
something like this:
location ~ .*.(js|css) {
expires 7d;
}
Also, make sure you are using args in the cache key:
proxy_cache_key “$host$uri$is_args$args”;
Regards,
Biazus
Posted at Nginx Forum:
http://forum.nginx.org/read.php?2,261338,261339#msg-261339
log
#3
log
#4
log
#5
You will need to be a little bit more specific than ‘this is not
working’
to get some help.
http://www.catb.org/esr/faqs/smart-questions.html
B. R.