# Nginx cache wired behavior

**URL:** <https://www.ruby-forum.com/t/nginx-cache-wired-behavior/208526>\
**Category:** NGINX\
**Created:** [June 20, 2011, 6:19pm UTC](https://www.ruby-forum.com/t/nginx-cache-wired-behavior/208526 "2011-06-20T18:19:06Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![dubstep](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/cdc98d/32.png) [@dubstep](https://www.ruby-forum.com/u/dubstep)\
**Post date:** [June 20, 2011, 6:19pm UTC](https://www.ruby-forum.com/t/nginx-cache-wired-behavior/208526/1 "2011-06-20T18:19:06Z")

</div>

Hello.  
I have the following problem:  
When static cached file is changed, nginx returns it to client after  
very long timeout. Great delay can be seen after receiving all file  
content on the client (client receives all file data from server at  
20:03:01, sends ack, and then receives Fin packet at 20:04:00).

I don’t see any related errors in error.log. How can I debug this issue?

Server config is the following:

server {  
listen 80; ## listen for ipv4  
server\_name …;  
access\_log off;  
client\_body\_buffer\_size 128k;

```
     open_file_cache max=2048 inactive=600s;
     open_file_cache_valid 2000s;
     open_file_cache_min_uses 1;

```

## open\_file\_cache\_errors on;

```
     location ~ /\.(ht|svn) {
             deny all;
     }

     location ~ \.(lib|inc|admin|handler|action|sql|log)$ {
             deny all;
     }

     location ~ /(crons|scripts|shared)/ {
             deny all;
     }

     location ~ \.php$ {

```

# limit\_conn one 2;

```
             include fastcgi_params;
             fastcgi_index index.php;
             fastcgi_param SCRIPT_FILENAME

```

/path/to/www$fastcgi\_script\_name;  
fastcgi\_buffer\_size 64k;

# fastcgi\_buffer\_size 4k;

```
             fastcgi_buffers 32 256k;

```

# fastcgi\_buffers 1024 4k;

```
              if ($uri !~ "^/images/") {

```

# fastcgi\_pass

unix:/var/run/fastcgi-mhouse-pool;  
fastcgi\_pass mhouse\_fastcgi;  
}  
}

```
     location / {
             root /path/to/www;
             index index.php;
     }

```

}

$ uname -a  
Linux hostname.provided.here 2.6.35-28-generic #50-Ubuntu SMP Fri Mar 18  
18:42:20 UTC 2011 x86\_64 GNU/Linux

$ nginx -V  
nginx version: nginx/0.7.67  
TLS SNI support enabled  
configure arguments: --conf-path=/etc/nginx/nginx.conf  
–error-log-path=/var/log/nginx/error.log  
–http-client-body-temp-path=/var/lib/nginx/body  
–http-fastcgi-temp-path=/var/lib/nginx/fastcgi  
–http-log-path=/var/log/nginx/access.log  
–http-proxy-temp-path=/var/lib/nginx/proxy  
–lock-path=/var/lock/nginx.lock --pid-path=/var/run/nginx.pid  
–with-debug --with-http\_dav\_module --with-http\_flv\_module  
–with-http\_geoip\_module --with-http\_gzip\_static\_module  
–with-http\_realip\_module --with-http\_stub\_status\_module  
–with-http\_ssl\_module --with-http\_sub\_module --with-ipv6 --with-mail  
–with-mail\_ssl\_module  
–add-module=/build/buildd/nginx-0.7.67/modules/nginx-upstream-fair

–  
Best regards,  
Alexander Pyhalov,  
system administrator of Computer Center of Southern Federal University

---

<div class="post-metadata">

**Author:** ![Alexander\_Pyhalov](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/8e8cbc/32.png) [@Alexander\_Pyhalov](https://www.ruby-forum.com/u/Alexander_Pyhalov)\
**Post date:** [June 20, 2011, 6:21pm UTC](https://www.ruby-forum.com/t/nginx-cache-wired-behavior/208526/2 "2011-06-20T18:21:34Z")

</div>

On 06/20/2011 20:18, Alexander Pyhalov wrote:

> Hello.  
> I have the following problem:  
> When static cached file is changed, nginx returns it to client after  
> very long timeout. Great delay can be seen after receiving all file  
> content on the client (client receives all file data from server at  
> 20:03:01, sends ack, and then receives Fin packet at 20:04:00).

## Some more info: first time file is returned quickly. Then, if you edit file, you receive this behavior. When cache is turned off, the delay disappears.

С уважением,  
Александр Пыхалов,  
системный администратор ЮГИНФО ЮФУ.
