Avoiding Nginx restart when rsyncing cache across machines

Maxim Dounin mdounin at mdounin.ru
Wed Sep 12 14:45:58 UTC 2018


Hello!

On Tue, Sep 11, 2018 at 04:45:42PM -0700, Quintin Par wrote:

> I run a mini CDN for a static site by having Nginx cache machines (in
> different locations) in front of the origin and load balanced by Cloudflare.
> 
> Periodically I run rsync pull to update the cache on each of these
> machines. Works well, except that I realized I need to restart Nginx and
> reload isn’t updating the cache in memory.
> 
> Really want to avoid the restart. Is this possible? Or maybe I am doing
> something wrong here.

You are not expected to modify cache contents yourself.  Doing so 
will likely cause various troubles - including not using the new 
files placed into the cache after it was loaded from the disk, not 
maintaining configured cache max_size and so on.

If you want to control cache contents yourself by syncing data 
across machines, you may have better luck by using proxy_store 
and normal files instead.

-- 
Maxim Dounin
http://mdounin.ru/


More information about the nginx mailing list