Home » Php » Slow File Uploads on virtual machine using virtualbox with vagrant + homestead

Slow File Uploads on virtual machine using virtualbox with vagrant + homestead

Posted by: admin November 29, 2017 Leave a comment


So i setup a virtual machine with vagrant using the virtual box container provided by laravel’s homestead. (on my osx env)

I used the nfs option method of sharing my directories to my local environment and this speed up response times drastically. On a typical app, i’m getting like 20-40ms load per page. However, I noticed that file uploads are terribly slow. I can upload a 1MB file on a simple form that does nothing to the file and it will take about a 30seconds to a minute. Is this normal, or is there a way to speed things up even further besides using nfs shares.


Things that come to my mind:

  • Edit /etc/nginx/nginx.conf, find the “sendfile” setting and change it to “off” (I’ve seen some reports of people having some issues with it turned on when using NFS);
  • Having xdebug enabled slows things down, and although I wouldn’t expect it to make such a huge difference as the one you’re noticing, if nothing else works it might be worth disabling it and see if helps;

If none of these help, create a repo on github to recreate the issue and I’ll have a look, see if I find anything.


This has been driving me crazy for some time, and no amount of toying with Vagrant’s or VirtualBox’s settings (sendfile, NFS, adjusting packet sizes, etc.) helped. But with the help of this answer on a similar problem relating to failed image uploads, I’ve finally cracked it:

The key, for me, was changing my hosts file to resolve my Homestead domains to the homestead VM’s IP of, rather than to (When doing this, you also drop the port :8000 from the URL, so you just navigate to homestead.app).

This changed my file upload speed from around 25 KB/sec to 5980 KB/sec!

It appears that the Laravel docs were updated a week ago to reflect this change. I wonder if your Yosemite install coincided with the docs change, and you set up your new box with while your old hosts setup pointed to

Even though the Laravel docs have been corrected—so this issue shouldn’t present itself for new Homestead installs—there are still a lot of tutorials floating around in the wild that suggest resolving Homestead domains to Hopefully this answer will help head off some aggravation!