Nginx : clear cache
I am using Nginx as a front server. Yesterday i edited some CSS files. But Nginx still serving old one. I am running Nginx in virtual-box. My friend suggested some solutions to clear Nginx cache.
If you are using virtualbox/vargant vm, this solution might solve your issue.
How to clear Nginx cache
sendfile might set to
Turned it off.
Remove all files from the cache directory.
find /path/to/your/cache -type f -delete
You can delete specific file cache. Search specific file:
grep -lr 'http://mydomain.pl/css/newedited.css' /var/nginx/cache/*
and deleted that one file.
Note : Append $ to the search term to get the exact hit.
Ex: grep -lr 'http://mydomain.pl/css/newedited.css$' /var/nginx/cache/*
Other solutions :-
- Delete cache directory:
- Turn on Gzip for these file types.
- Clear the browser cache by header input.
expires modified +90d;