Vagrant: Apache/nginx serving outdated static files? Turn off sendfile()!
Made some changes to static files (css for example), but Apache/nginx on your Vagrant VM still delivering the old version or even corrupted files? Then you should turn off sendfile() in your Apache/nginx configuration!
Simply spoken, sendfile() uses kernel calls to copy files directly from disc to tcp. If you are using remote filesystems (like nfs or the VirtualBox Guest Additions stuff), this method isn't reliable.
You can find more info about sendfile() in this techrepublic article.
To turn off sendfile() in Apache, you can use the EnableSendfile off
directive, for nginx use sendfile off
.
Written by Pierre Groth
Related protips
4 Responses
Thanks a lot !
Wow thanks! I've been searching for this for hours but all I was finding was stuff about etags/mod_expires which I knew was not the issue.
Thanks!
I was playing wit ETags and headers with no luck. Got to dive into the SendFile subject in my spare time.
Thanks! You make my day!