nginx clear static file cache without restarting

Maxim Dounin mdounin at mdounin.ru
Wed Jun 13 10:37:14 UTC 2012


Hello!

On Wed, Jun 13, 2012 at 02:04:56AM -0400, chenmin7249 wrote:

> i'm using nginx1.0.15 stable to serve static files, and with following
> configurations:
> 
>     sendfile        on;
>     tcp_nopush     on;
>     tcp_nodelay    on;
>     open_file_cache max=1048000 inactive=604800s;
>     open_file_cache_min_uses 1;
>     open_file_cache_valid 3600s;
> 
> here is my problem, how can i clear the static file cache without
> restarting nginx without 'killall -HUP nginx'?

No, the only way to reset open file cache is to restart worker 
processes.  Sending SIGHUP to let nginx start new worker processes 
and gracefully shutdown old ones is the easiest way to do this.

And just to make sure it's clear: restarting worker processes via 
SIGHUP doesn't imply any downtime.  All connections will be 
accepted and all requests will be handled, no animals will be 
harmed and so on.

Maxim Dounin



More information about the nginx mailing list