Corrupted files during development using PhpStorm & Vagrant

I’m currently trying to develop my own WordPress theme from scratch (called “Tengu” but be warned: at time of writing it’s nowhere near usable yet). And I encountered a rather odd bug: part of the style.css file would get corrupted when viewing through the browser.

I am using PhpStorm on Windows and for live testing I use a virtual machine using Vagrant. On it I was using a plain, hardly modified installation of nginx to serve a WordPress test blog. As it turns out, by default nginx configuration turns the “sendfile” option on which usually makes sense, but sendfile apparently is extremely unreliable when used with remote file systems (in my case, VirtualBox extensions).

The quick solution: turn sendfile off during development (look for the appropriate line in /etc/nginx/nginx.conf). Supposedly this also applies to Apache btw. The problem went away immediately when I did that.