流浪/ VirtualBox虚拟/ Apache2的奇怪行为缓存 [英] Vagrant/VirtualBox/Apache2 Strange Cache Behaviour
问题描述
我用流浪来运行的Apache2 Ubuntu的供电VirtualBox的。
I'm using Vagrant to run an Ubuntu powered VirtualBox with Apache2.
网络服务器,除其他外,从我的/游民目录提供静态文件。
The webserver, among others, serves static files from my /vagrant directory.
这行之有效的大部分时间。但是,当我在我的共享文件夹改变图像并重新加载网页,图像的previous版本供应,但它截断。
This works well most of the time. But when I change an image on my shared folder and reload the website, the previous version of the image is served, but it's truncated.
如果我从我的共享文件夹,先删除旧图片,刷新网站,所以不显示图片,然后保存新文件,并重新加载网页它的工作原理。
It works if I delete the old picture first from my shared folder, refresh the website so the picture is NOT shown, then save the new file and reload the website again.
有谁知道这个问题?我没有什么特别的安装,只是阿帕奇2的mod_rewrite和PHP与蒙戈,APC插件,MongoDB的以及用的NodeJS一堆脚本。
Does anyone knew about this problem? I don't have anything special installed, just Apache 2 with mod_rewrite and PHP with Mongo, APC Plugin, MongoDB as well as nodeJS with a bunch of scripts.
推荐答案
找到答案的这里:
JC,
你看到的可能是因为服务器提供的静态文件
使用的sendfile()系统调用,这是与VirtualBox的文件破
系统。你需要在你的服务器上禁用的sendfile()的用法。对于Apache:
What you're 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:
EnableSendfile关闭
EnableSendfile off
和nginx的为:
SENDFILE关闭;
And for nginx: sendfile off;
最佳,
米切尔
Best, Mitchell
这篇关于流浪/ VirtualBox虚拟/ Apache2的奇怪行为缓存的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!