Vagrant/VirtualBox/Apache2 奇怪的缓存行为 [英] Vagrant/VirtualBox/Apache2 Strange Cache Behaviour

查看:30
本文介绍了Vagrant/VirtualBox/Apache2 奇怪的缓存行为的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用 Vagrant 运行带有 Apache2 的 Ubuntu 驱动的 VirtualBox.

I'm using Vagrant to run an Ubuntu powered VirtualBox with Apache2.

除其他外,网络服务器提供我的/vagrant 目录中的静态文件.

The webserver, among others, serves static files from my /vagrant directory.

这在大多数情况下运行良好.但是,当我更改共享文件夹中的图像并重新加载网站时,会提供该图像的先前版本,但它被截断了.

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.

有人知道这个问题吗?我没有安装任何特殊的东西,只有带有 mod_rewrite 的 Apache 2 和带有 Mongo 的 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() 使用.对于阿帕奇:

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:

启用发送文件关闭

对于 nginx:发送文件关闭;

And for nginx: sendfile off;

最好的,米切尔

这篇关于Vagrant/VirtualBox/Apache2 奇怪的缓存行为的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆