I’ve begun using Vagrant with Virtualbox for Web Development, specifically for Rails development. This allows me to spin up an environment as close to production as possible, and it keeps my host system clean from various projects’ clutter. It’s quite lovely, and I’ll definitely devote a separate post to that topic. However:
Recently, I ran into an issue with Sendfile and Virtualbox’s shared folder support. It seems that the use of Kernel sendfile by either Apache (both debian and centos flavors) or Nginx to serve static files doesn’t work if you update those files at all once they’ve been served. Needless to say, this doesn’t work for doing any Javascript development…
After digging, the fix is simply to disable sendfile support in your HTTP server of choice. A quick search for ‘sendfile’ in your httpd.conf, apache.conf or nginx.conf will reveal an ‘On/Off’ toggle:
#
# EnableSendfile: Control whether the sendfile kernel support is
# used to deliver files (assuming that the OS supports it).
# The default is on; turn this off if you serve from NFS-mounted
# filesystems. Please see
# http://httpd.apache.org/docs/2.2/mod/core.html#enablesendfile
#
EnableSendfile off
The solution to the issue can be found in the VirtualBox forums: http://forums.virtualbox.org/viewtopic.php?f=1&t=24905
More info about Sendfile can be found in the Apache documentation: http://httpd.apache.org/docs/2.0/mod/core.html#enablesendfile
Thx mate, that really helped!
If we ever cross paths, I’m going to buy you a coffee or a beer, whichever you prefer. You’ve saved my sanity.
I’ve been nearly ripping my hair out over this issue for weeks now. Unfortunately this solution does not work for me, but seems to be the only solution available! Is there anyone else out there for which this solution just DOES NOT work?!?!
Never mind, I am a bonehead. Thanks for this solution, saved my butt. Feel free to delete my comment…
Thank you, thank you, thank you. Took days to find the answer to this
Thank you, had disabled sendfile in nginx, this post was the missing piece.