Solution to Apache Web Server and VirtualBox NFS Mounted File Cache Problems

I have my VirtualBox installed on my Mac OS X Lion spinning a Virtual CentOS instance where my LAMP stack is running. This idea of a virtual server environment is really neat because it gives me the luxury to develop in a Linux environment close enough to my Linux setup in production. But I encountered a problem that seems simple but I couldn’t find an obvious solution – shared folder caching problem.

Every time I make changes in my JS/CSS files, it doesn’t get updated on the web page itself. I checked the file in the web server directory itself and it’s updated. But when I try to access it via its url, I couldn’t see the changes that I made. Which made me think that it has something to do with Apache and not VirtualBox.

After extensive googling and researching, I stumbled into these Apache directives:

The solution is to disable the above directives which are enabled by default. So basically we’re disabling memory mapping (EnableMMAP) which is not good when we’re working with NFS mounted files. We’re also disabling apache’s sendfile (EnableSendFile) support which basically reads static file from buffer or cache without reading the actual file itself.

Here’s how your configuration will look like:

<Directory "/path/to/document_root/">
# Some other directives here

EnableMMAP Off
EnableSendfile Off
</Directory>

I hope that it works for you and saved you from spending too much time finding out the solution.

  1. yep really like what youve done here

    [WORDPRESS HASHCASH] The poster sent us ’1490921088 which is not a hashcash value.

Leave a Comment


5 + nine =


NOTE - You can use these HTML tags and attributes:
<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>