2013-02-10 43 views
0

我在向公众开放Google静态网站时遇到了一个奇怪的问题。gsutil setwebcfg -m index.html -e 404.html不起作用

我创建了一个名为fixparser.targetcompid.com的存储桶。我遵循谷歌的程序添加一个识别的HTML文件到我现有的主机。

我可以复制我的htmls/css/js/etc。放入桶中,甚至查看index.html页面时,我提供了完整的URL: http://commondatastorage.googleapis.com/fixparser.targetcompid.com/index.html

但是,我不能得到的索引文件,如果我只提供一般的网站地址: http://commondatastorage.googleapis.com/fixparser.targetcompid.com

继是我看到的时候我设置MainPageSuffix和NotFoundPage:


$ ./gsutil setwebcfg -m index.html -e 404.html gs://fixparser.targetcompid.com 
Setting website config on gs://fixparser.targetcompid.com/... 


$ ./gsutil setwebcfg -m index.html -e 404.html gs://fixparser.targetcompidxxxx.com 
Setting website config on gs://fixparser.targetcompidxxxx.com/... 
GSResponseError: status=404, code=NoSuchBucket, reason=Not Found. 


$ ./gsutil getwebcfg gs://fixparser.targetcompid.com 
Getting website config on gs://fixparser.targetcompid.com/... 

-WebsiteConfiguration> 
     -MainPageSuffix> 
       index.html 
     -/MainPageSuffix> 
     -NotFoundPage> 
       404.html 
     -/NotFoundPage> 
-/WebsiteConfiguration> 
(I don't know how else to format this xml snippet) 

回答

3

的谷歌云存储网站的配置只会影响针对c.storage.googleapis.com的CNAME别名请求。在此特定示例中,您可能希望为fixparser.targetcompid.com设置CNAME别名以指向c.storage.googleapis.com。一旦你这样做,打开http://fixparser.targetcompid.com将加载您使用gsutil setwebcfg命令设置的index.html页面。

Google云存储团队Mike Schwartz

+0

是否存在此限制的技术原因?在交通繁忙的网站上,在确保谷歌存储正常工作之前,我会紧张地修改cname。 – Shahbaz 2013-02-10 22:53:54

+0

此外,是正确的网址c.storage.googleapis.com或commondatastorage.googleapis.com(这是什么云莓告诉我)? – Shahbaz 2013-02-10 22:55:06

+0

您可以随时为不同的cname创建一个存储桶(例如mysite-test.example.com),并确保一切正常工作,就像您期望的一样。 对于URL,请查看https://developers.google.com/storage/docs/reference-uris,我相信这是该主题的官方参考。 – Benson 2013-02-11 06:00:10