Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

NGINX not picking up changes in Vagrant Synced folder

I have an Ubuntu VirtualBox that's setup by Vagrant. Its running NGINX to serve some static files and a Django app.

I have the source folder synced via vagrant to the repo in my host (windows). I can make changes to a Javascript file in Windows and verify that the changes are made to my file in the VM by SSH'ing in and opening the file in nano.

However, when I make the changes remotely, NGINX seems to serve up the unchanged version with "illegal" characters added to the end (which really freaks out browsers). I get the same file when I CURL localhost while ssh'd into the vm. EDIT It actually does the same thing when I edit the file via SSH

I can reload the vm via vagrant (which re-syncs the folders) and it works fine until the next remote change.

Restarting nginx and gunicorn doesn't help.

Does vagrant lock the files so that nginx has to rely on a cache? What might be going on here?

Thanks!

like image 285
D_Naish Avatar asked Jan 17 '14 20:01

D_Naish


1 Answers

Apparently my coworker has better Google-foo than I.

This is apparently a known issue with virtualbox and nginx that has to do with the nginx's sendfile. You can simply add "sendfile off;" in either your server or location blocks in the nginx config. Here's a blogpost about it: nginx virtualbox static files

like image 200
D_Naish Avatar answered Oct 14 '22 18:10

D_Naish