How to host an entire site on Google Cloud Storage?

后端 未结 8 1135

Is there any way to host an entire site on Google Cloud Storage? That is, map a bucket directly to a top level domain.

E.g. create a bucket called <

8条回答
  •  心在旅途
    2020-12-14 02:08

    @Christian Hudon's answer is very clear. I've been trying to do the same and I've been having the problems discussed above. What you can also do is the following:

    Create two CNAME entries one empty (example.com) and another one WWW (www.example.com) Now create two bucket folders: example.com and www.example.com Decide which one will host the pages and assets and which one just the pages.

    Let's say www.example.com is the source so you have your folder structure, images, css, javascripts, etc... in there and because the site is static what you can do is to add the full domain on the source of your assets.

    Something like

     
    

    Then copy over the html pages only to example.com. Obviously if you have example.com/contact/index.html you need to create the folder too.

    It's a little bit annoying but it was the only way I could get it to work. This is not ideal if you need to change the content quite often but at least it works, it all depends on your needs.

提交回复
热议问题