VirtualBox for Apache 中的共享文件夹 [英] Shared folder in VirtualBox for Apache

查看:31
本文介绍了VirtualBox for Apache 中的共享文件夹的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的主机是 ArchLinux,我在 CentOS 来宾中运行 Apache.我在共享文件夹中有 vhost 配置和所有站点代码.为了能够将虚拟主机配置放在共享文件夹中,我将共享文件夹安装为 apache:apache.

My host machine is ArchLinux and I'm running Apache in a CentOS guest. I have the vhost configuration and all the site code in a shared folder. To be able to put the vhost configuration in a shared folder I mounted the shared folder as apache:apache.

shared    /mnt/shared    vboxsf    defaults,uid=48,gid=48  0 0

当我在主机中编辑文件时,Apache 将始终开始发送带有尾随字符的旧版本文件.在 vim 中,它们显示为 ^@,所以我猜它们是空字符.空字符的数量与我所做的更改数量有关,即使我编辑了第一行,空字符也会出现在最后.如果我要推测,它看起来像一个糟糕的差异.

When I'm editing files in the host, Apache will consistently start sending old versions of the file with trailing characters. In vim, they show up as ^@, so I guess they're null characters. The number of null characters is related to the number of changes I make even if I edit the first line, null characters show up at the end. If I were to speculate, it looks like a bad diff.

如果我停止 httpdumount、重新挂载并启动 httpd,文件看起来不错.只是重新启动 httpd 没有帮助.

If I stop httpd, umount, remount, and start httpd the file looks fine. Just restarting httpd doesn't help.

我将如何调试挂载?/var/log 中没有任何内容让我感到意外.

How would I go about debugging the mount? Nothing jumped out at me in /var/log.

推荐答案

我错了;它发生在其他地方,但我注意到它只有 .css 和 .js 文件.搜索使我找到了这篇文章,其中讨论了 vboxsf 和小文件.

I was wrong; it was happening elsewhere but I noticed that it was only with .css and .js files. A search led me to this post which talks about a problem with vboxsf and small files.

解决办法是在Apache中设置

The solution is to set, in Apache

    EnableSendfile off

这篇关于VirtualBox for Apache 中的共享文件夹的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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