How to clear the cache of nginx?

I had the exact same problem – I was running my nginx in Virtualbox. I did not have caching turned on. But looks like sendfile was set to on in nginx.conf and that was causing the problem. @kolbyjack mentioned it above in the comments.

When I turned off sendfile – it worked fine.

This is because:

Sendfile is used to ‘copy data between one file descriptor and another‘ and apparently has some real trouble when run in a virtual machine environment, or at least when run through Virtualbox. Turning this config off in nginx causes the static file to be served via a different method and your changes will be reflected immediately and without question

It is related to this bug: https://www.virtualbox.org/ticket/12597

Leave a Comment