我正在寻找在Nginx上设置现金,因此某些文件的caching永远不会超过2个小时,而且caching将在每天早上6点15分过期。 我遇到的问题是在相同的位置块中设置这两个时间限制。
到目前为止,我有这个
uwsgi_cache_path /data/nginx_cache levels=1:2 keys_zone=my_cache:10m max_size=10g; . . . location ~* /my/path/and/image.*\.png$ { expires 7200; include uwsgi_params; uwsgi_pass unix:/tmp/my_project_name.sock; uwsgi_cache_key $request_uri; uwsgi_cache my_cache; add_header Pragma public; add_header Cache-Control "public"; add_header X-Cache-Status $upstream_cache_status; }
我查看了http://nginx.org/en/docs/http/ngx_http_headers_module.html哪些设置caching过期使用expires @15h30m; 所以我试着设置
expires 7200, @6h15m;
但是这个语法似乎不被接受。
注意:另外,我还需要让用户的浏览器caching每30分钟左右过期一次。