VirtualBox Ubuntu guest虚拟机上的nginx提供过时的内容 [英] nginx on VirtualBox Ubuntu guest serves stale content

查看:84
本文介绍了VirtualBox Ubuntu guest虚拟机上的nginx提供过时的内容的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我不知道这是Ubuntu,VirtualBox还是nginx的问题.

I don't know if this is a problem with Ubuntu, VirtualBox or nginx.

我在Ubuntu上运行nginx,Ubuntu是Windows 7上的VirtualBox来宾.Windows 7文件夹作为自动安装的只读共享文件夹安装在VirtualBox中. Ubuntu将该文件夹视为/media/sf_jsource

I am running nginx on Ubuntu, which is a VirtualBox guest on Windows 7. A Windows 7 folder is mounted as a auto-mount, read-only Shared Folder in VirtualBox. Ubuntu sees the folder as /media/sf_jsource

现在,如果我在Windows 7上的该文件夹中编辑文件,Ubuntu上的shell命令(cat)将看到新内容.这似乎暗示VirtualBox和Ubuntu可以很好地接受新更改.

Now, if I edit a file in that folder on Windows 7, a shell command (cat) on Ubuntu sees the new content. That would seem to imply that VirtualBox and Ubuntu are picking up the new changes just fine.

但是,在Ubuntu上运行的Nginx服务器会继续提供过时的内容.这表明问题出在nginx缓存文件上.我到处搜索,看到一些条目(从2010年到2011年)禁用了Nginx缓存.但是,我尚未在nginx配置中启用任何缓存,也看不到要清除的/var/cache/nginx或/opt/cache/nginx目录.

However, the nginx server running on Ubuntu keeps serving the stale content. That suggested that the problem was with nginx caching files. I googled around and saw a couple of entries (from 2010, 2011) to disable the nginx cache. However, I have not enabled any cache in the nginx config, and I don't see any /var/cache/nginx or /opt/cache/nginx directory to purge.

现在,有趣的是重启nginx并不能解决问题.我必须重新启动Ubuntu guest虚拟机才能使nginx看到新内容,这没有意义,因为Ubuntu中的cat在重新启动之前总会看到更改.

Now, the funny thing is that restarting nginx doesn't fix the problem. I have to restart the Ubuntu guest for nginx to see the new content, which doesn't make sense since cat in Ubuntu was seeing the changes anyway before reboot.

几乎所有内容(nginx,Ubuntu,VirualBox)都是2012年初的最新版本.

Pretty much everything (nginx, Ubuntu, VirualBox) is the latest version as of early 2012.

推荐答案

一些事实:

  1. 如果您尚未在nginx中启用缓存,那么nginx将不会提供缓存的内容.

  1. If you have not enabled caching in nginx, then nginx will not serve cached content.

如果重新启动nginx,则在任何情况下都将丢弃所有缓存的内容.

If you restart nginx, any cached content is discarded in any case.

结论: 从浏览器本身开始,在请求周期的许多级别进行缓存.由于事实表明缓存不是由Nginx进行的,因此您需要从浏览器开始调查其他可能的缓存位置.

Conclusion: Caching happens at many levels in the request cycle starting from your browser itself. Since the facts indicate that the caching is not by Nginx, you need to look into other possible cache locations starting with your browser.

这篇关于VirtualBox Ubuntu guest虚拟机上的nginx提供过时的内容的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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