location /static {
alias /home/ubuntu/Documents/zibann/momsite/momsite/static; # your Django project's static files - amend as required
if ($uri ~* ".*config.js") {
expires off;
}
if ($uri ~* ".*\.(js|css|png|jpg|jpeg|gif|swf|svg)" ) {
access_log off;
expires 365d;
add_header Cache-Control public;
}
}
希望
config.js
不会被缓存,但确实如此。如何从缓存中排除一个文件?
最佳答案
为 config.js 在其他块之上创建一个单独的位置块。
location ~ config\.js {
alias xyz;
expires off;
}
location static etc
关于caching - Nginx,关闭特定文件的缓存,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/29466494/