I have this problem:
- I read directly (as static content) an image from https://whatever.com/static/image.png . The image is displayed properly.
- I overwrite this file with another one and I try again to read it accessing https://whatever.com/static/image.png
- What happens next seems is one of the 2 things below but sort of randomly:
a. a truncated version of the new image will be displayed, that is, all but some of the bottom part will be displayed
b. sometimes the image isn't served at all and an error is returned (in Chromium):
Error 324 (net::ERR_EMPTY_RESPONSE): The server closed the connection without sending any data.
- If I restart nginx the image will be displayed just fine.
I can provide config files if they're needed.
Anyone have a clue why this is happening?
I noticed that if I turn off open_file_cache
the problem won't appear anymore but I still look for a solution to this not involving turning off file cache.
I am not sure this is the best solution but it did the trick for me:
I changed these lines in nginx.conf
open_file_cache max=5000 inactive=8h;
open_file_cache_errors on;
open_file_cache_valid 1h;
open_file_cache_min_uses 1;
to
open_file_cache max=8000 inactive=5m;
open_file_cache_errors on;
open_file_cache_valid 5m;
open_file_cache_min_uses 20;
and now it generally works fine.