There is an strange behaviour with cache in Apache and Nginx if you are using a Vagrant box.

The problem is that when you try to edit some file, for example a scripts.js file, you get the error “Unexpected token ILLEGAL” on the Console.

What you are seeing is probably because the server serving the static files is using the “sendfile()” syscall, which is broken with the VirtualBox file system. You need to disable sendfile() usage in your server.

 

For Apache:

Open your httpd.conf file and change the following directive or add it if you don’t have it.

For Nginx:

Open your nginx.conf file and change the following directive or add it if you don’t have it.

Of course you can also change it for your individual virtual host file.

IMPORTANT:

After you finish to edit your configuration file, you need to reload your vagrant box if you are using one.

 

Leave a comment