如何快速更新Google云端存储中的静态网站? [英] How to Quickly Update Static Site on Google Cloud Storage?

查看:686
本文介绍了如何快速更新Google云端存储中的静态网站?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个托管在Google云端存储上的静态网站。我按照此处所述的相同方法进行设置:

https://cloud.google.com/storage/docs/hosting-static-website



我已经购买了域名,并且此时网站正在顺利运行。我仍在对网站内容进行更改。我目前的工作流程是在Windows机器上本地编辑文件(例如index.html),然后使用 https://console.cloud.google.com/storage/browser ,确保将它们设置为公共链接。然后我使用浏览器导航到我的网站,看看发生了什么变化。

大多数时候,当我这样做时,我的网站似乎没有变化!我甚至可以检查该网站的源文件,发现它们与我存储桶中当前的文件不匹配。如果我等待一段时间,从几分钟到几小时不等,网站最终会改变。我希望它是即时更改的情况,以便我可以快速测试更改(我无法在本地进行测试,因为我使用的框架在没有运行本地主机的情况下不起作用,这是我不能做到的)。我怎样才能使我的云存储静态网站更新迅速?



我最好的猜测可能发生的原因是相当分散的。是否需要一段时间才能让全球的各种gcp服务器同步?它与我的域名注册商的TTL设置或其他设置有什么关系? (namecheap,目前使用默认值)。

解决方案

尽管在GCS基础设施内传播更改并非不可能,你提到它的行为是不太可能的。



更有可能你正在查看缓存效果。可能发生的情况:Google云中的




  • 在您的浏览器中使用
  • - 尝试在部署后清除浏览器的缓存

  • 之间的任何位置(并且您无法控制此操作)。


I have a static site hosted on google cloud storage. I set it up per the same methodology described here:

https://cloud.google.com/storage/docs/hosting-static-website

I have purchased a domain, and the website is running smoothly on it at this point. I am still in the process of making changes to the content of the site. My current workflow is to edit the files (for example, index.html) locally on my windows machine, and then upload the modified files to my storage bucket using the online console/ storage browser at https://console.cloud.google.com/storage/browser, making sure to set them as public links. I then navigate to my website using chrome to see what changes have occurred.

Most of the time, when I do this, my site appears to be unchanged! I can even inspect the source files for the site and discover that they do not match the files that are currently in my storage bucket. If I wait some time, varying from minutes to hours, the website does eventually change. I would like it to be the case that it changes instantly so I can test changes quickly (I cannot test locally because the framework I am using does not function without running a localhost, which I cannot do). How do I do make my cloud storage static site update quickly?

My best guess for the reasons this might happen are pretty scattershot. Is it that it takes some amount of time for various gcp servers around the world to sync together? Would it have anything to do with the TTL settings or other settings on my domain name registrar? (namecheap, currently using defaults).

解决方案

While it's not impossible for the propagation of the changes inside the GCS infrastructure to account for the behaviour you mention it's rather unlikely.

It's more likely you're looking at a cache effect. Which can happen:

  • inside the Google cloud:
  • in your browser - try clearing your browser's cache after deployments
  • pretty much anywhere in between (and you have no control over this).

这篇关于如何快速更新Google云端存储中的静态网站?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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