我需要为nginx上的python(django)应用程序configurationcaching。 一切工作正常,但不时从caching中获得空白页面。 我没有看到nginx和uwsgi日志中的任何错误。 在正常情况下,我得到的HTTP/1.1 200 resposne 24615 bytes从nginx的HTTP/1.1 200 resposne 24615 bytes长,但有时它是20字节长。
HTTP/1.1 200 0.08 secs: 24615 bytes ==> / HTTP/1.1 200 0.07 secs: 24615 bytes ==> / HTTP/1.1 200 7.71 secs: 24615 bytes ==> / HTTP/1.1 200 0.06 secs: 20 bytes ==> / HTTP/1.1 200 0.06 secs: 20 bytes ==> / HTTP/1.1 200 0.07 secs: 20 bytes ==> / HTTP/1.1 200 7.79 secs: 24615 bytes ==> / HTTP/1.1 200 0.07 secs: 24615 bytes ==> /
我的cachingconfiguration:
uwsgi_cache_path /var/cache/nginx_cache levels=1:2 keys_zone=my_cache:1m max_size=500m inactive=30m use_temp_path=off; uwsgi_cache my_cache; uwsgi_cache_key "$uri"; uwsgi_ignore_headers Cache-Control X-Accel-Expires Expires Vary Set-Cookie; uwsgi_cache_valid 2s;
和想法这20个字节的答复是什么原因?
看起来像cachingHEAD响应。 根据nginx文档( http://nginx.org/en/docs/http/ngx_http_uwsgi_module.html#uwsgi_cache_methods)HEAD方法总是添加到uwsgi_cache_methods。