# Nginx static file deletion

**URL:** <https://www.ruby-forum.com/t/nginx-static-file-deletion/209766>\
**Category:** NGINX\
**Created:** [July 22, 2011, 5:02am UTC](https://www.ruby-forum.com/t/nginx-static-file-deletion/209766 "2011-07-22T05:02:46Z")\
**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:** [July 22, 2011, 5:02am UTC](https://www.ruby-forum.com/t/nginx-static-file-deletion/209766/1 "2011-07-22T05:02:46Z")

</div>

hi.

I found out recently that everytime i restart my nginx, nginx is trying  
to delete the static directory and everything under it. following is my  
static directory configuration:

http{

…

proxy\_cache\_path /path/to/static levels=1:2 keys\_zone=one:60m  
inactive=3d max\_size=100m;  
proxy\_temp\_path /tmp/cache;

location ~\*  
(.txt$|.ico$|.css$|.js$|.png$|.gif$|.jpg$|.jpeg$|.json$|.xml$|.zip$|.html$)  
{

```
       root /path/to/static;
       proxy_cache one;
       proxy_cache_key www.website.com$request_uri;
       proxy_cache_valid 200 1h;
       proxy_cache_use_stale error timeout invalid_header;
       access_log /var/log/nginx/access.log;
       error_log /var/log/nginx/error.log;
       expires 7d;
    }

```

}

this is the only place where i point to the static directory.

any help is appreciated.

Thank You

Steve Z.

---

<div class="post-metadata">

**Author:** ![stevezhuo](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/da6949/32.png) [@stevezhuo](https://www.ruby-forum.com/u/stevezhuo)\
**Post date:** [July 22, 2011, 3:44pm UTC](https://www.ruby-forum.com/t/nginx-static-file-deletion/209766/2 "2011-07-22T15:44:05Z")

</div>

Hi,

I think you have misunderstood the purpose of the proxy\_cache\_path. This  
is the path where you want the cached files to be saved to, not the path  
of the files to be cached. The files to be cached will come from your  
upstream you reach via proxy\_pass.

You cannot use proxy cache with static files. (Besides, your OS will  
handle caching frequently accessed files)

Posted at Nginx Forum:

> **[Re: Nginx static file deletion](https://forum.nginx.org/read.php?2,212783,212808#msg-212808)**
>
> hi. I found out recently that everytime i restart my nginx, nginx is trying to delete the static directory and everything under it. following is my static directory configuration: http{ ..... proxy\_cache\_path /path/to/static le
