Nginx static file deletion

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.

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: