# Caching question for large (ish) file

**URL:** <https://www.ruby-forum.com/t/caching-question-for-large-ish-file/209424>\
**Category:** NGINX\
**Created:** [July 13, 2011, 7:26pm UTC](https://www.ruby-forum.com/t/caching-question-for-large-ish-file/209424 "2011-07-13T19:26:08Z")\
**Posts on this page:** 5\
**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:** [July 13, 2011, 7:26pm UTC](https://www.ruby-forum.com/t/caching-question-for-large-ish-file/209424/1 "2011-07-13T19:26:08Z")

</div>

Hello Everyone! First time E-mailer with a small question I hope  
someone could answer for me.

I’ve searched through google for my answers but i haven’t found  
anything that tells me what i’m doing wrong…

So I have a test setup that has a Dynamic node and an edge node. The  
single point CDN is up and working (thanks to a ton of help my a buddy  
of mine). But one issue i’ve seen is that in our tests, even after  
specifying a month for a cache time, the server still seems to delete  
the cache when i come back around 24 hours later.

The goal of the long cache time is that I’d like to create a CDN  
platform that I could let users stream video files that are \>100MB…  
The video files would obviously not be changing within a year (let  
alone a month)… So one of my thoughts is that the size of the files  
are the reason for the deletion of the Cached content…

My apologies for any stupid questions, i’ve been working on this for  
the last few months and finally just decided to email the list to see  
if anyone would be able to help…

The configuration of the edge node for the proxy cache for the server  
block is as follow…  
location / {  
proxy\_pass [http://static.mysite.com](http://static.mysite.com);  
proxy\_cache site-cdn;  
proxy\_cache\_valid 200 302 301 any 365d;  
proxy\_cache\_use\_stale updating;  
proxy\_temp\_path /var/www/cdn/site/temp;  
proxy\_buffering on;  
}

Thank you for any help! I truly appreciate it!

-Brad

---

<div class="post-metadata">

**Author:** ![unknown](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/u/4bbf92/32.png) [@unknown](https://www.ruby-forum.com/u/unknown)\
**Post date:** [July 13, 2011, 9:04pm UTC](https://www.ruby-forum.com/t/caching-question-for-large-ish-file/209424/2 "2011-07-13T21:04:37Z")

</div>

Show us the conf line where the cache is defined

Sent from my iPhone

---

<div class="post-metadata">

**Author:** ![unknown](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/u/4bbf92/32.png) [@unknown](https://www.ruby-forum.com/u/unknown)\
**Post date:** [July 13, 2011, 9:17pm UTC](https://www.ruby-forum.com/t/caching-question-for-large-ish-file/209424/3 "2011-07-13T21:17:00Z")

</div>

Quoting Richard K. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid):

> Show us the conf line where the cache is defined
> 
> Sent from my iPhone

Hey Richard,

Here is the full nginx.conf file \>.\<

user nobody;  
worker\_processes 4;

error\_log logs/error.log notice;

pid logs/nginx.pid;

events {  
worker\_connections 1024;  
}

http {  
proxy\_cache\_path /var/www/cdn/site/cache levels=1:2  
keys\_zone=site-cdn:8m max\_size=1000m inactive=600m;  
proxy\_temp\_path /var/www/cdn/site/temp;  
open\_file\_cache max=1000 inactive=300s;  
open\_file\_cache\_valid 360s;  
open\_file\_cache\_min\_uses 2;  
open\_file\_cache\_errors off;  
include mime.types;  
include fastcgi.conf;  
include proxy.conf;  
sendfile on;  
keepalive\_timeout 65;  
log\_format main ‘$remote\_addr - $remote\_user [$time\_local]  
“$request” $status $body\_bytes\_sent “$http\_referer” “$http\_user\_agent”  
“$http\_x\_forwarded\_for”’;  
upstream [static.site.com](http://static.site.com) {  
server xx.xx.xx.xx:80;  
}

server {  
listen 80;  
server\_name [static.site.com](http://static.site.com);  
location / {  
proxy\_pass [http://static.site.com](http://static.site.com);  
proxy\_cache site-cdn;  
proxy\_cache\_valid 200 302 301 any 365d;  
proxy\_cache\_use\_stale updating;  
proxy\_temp\_path /var/www/cdn/site/temp;  
proxy\_buffering on;  
}  
}

---

<div class="post-metadata">

**Author:** ![unknown](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/u/4bbf92/32.png) [@unknown](https://www.ruby-forum.com/u/unknown)\
**Post date:** [July 14, 2011, 4:40am UTC](https://www.ruby-forum.com/t/caching-question-for-large-ish-file/209424/4 "2011-07-14T04:40:18Z")

</div>

inactive=600m;

This deletes files after 600 minutes if it wasn’t accessed in that time

Increase it 🙂

Sent from my iPhone

On 13 Jul 2011, at 20:16,  
“removed\_email\_address@domain.invalid[mailto:removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)”  
\<removed\_email\_address@domain.invalid[mailto:removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)\> wrote:

inactive=600m;

---

<div class="post-metadata">

**Author:** ![unknown](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/u/4bbf92/32.png) [@unknown](https://www.ruby-forum.com/u/unknown)\
**Post date:** [July 14, 2011, 12:41pm UTC](https://www.ruby-forum.com/t/caching-question-for-large-ish-file/209424/5 "2011-07-14T12:41:08Z")

</div>

My hero… Thanks so much Richard!!!

Brad R.

Systems Engineer / [AnimeFTW.tv](http://AnimeFTW.tv) Site Admin

FTW Entertainment LLC

From: Richard K. [[mailto:removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)]  
Sent: Wednesday, July 13, 2011 9:40 PM  
To: [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)  
Subject: Re: Caching question for large (ish) file

inactive=600m;

This deletes files after 600 minutes if it wasn’t accessed in that time

Increase it 🙂

Sent from my iPhone

On 13 Jul 2011, at 20:16, “removed\_email\_address@domain.invalid”  
[removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

inactive=600m;
