问题
So, I've spent about 5 days searching for an answer here and on Google Docs, including having one of their support people help me. My domain still doesn't resolve to the website.
For the record, the website works if I use the ugly url (http://storage.googleapis.com/7thgradeplay.org/index.html).
I have transferred the domain to google domains, days ago.
I have verified the domain with Google Search Console. Billing is enabled and accruing. Public_html is set on all files and folders.
I am using Google Domains name servers. I am not using Google Cloud DNS.
Per Google support: Synthetic Records: 302 redirect @.7thegradeplay.org to www.7thgradeplay.org Custom Resource Records: www CNAME 7thegradeplay.org
Does this matter? storage bucket name is 7thegradeplay.org.
I think that's about all the config I've done.
All of these changes were done on Friday (3 days ago), and I still get a 404 error when I try to go to the website. I have followed the instructions and tried to troubleshoot with these pages: https://cloud.google.com/dns/troubleshooting https://cloud.google.com/storage/docs/hosting-static-website
The only thing I varied was the name of the bucket in storage. I used a bucket name without the leading 'www.' Please don't tell me this is all it takes to break it.
All help is appreciated.
P.S. I added a bucket called www.7thegradeplay.org with all the same files. Waited 15 minutes. still 404 error.
P.P.S. I found an answer, but it didn't work: Connect Google domain to Google Cloud Bucket.
I will retry step #5 in the PPS above tomorrow, after the PS change has had time to 'stew'.
Again, any help is appreciated.
回答1:
Your bucket name needs to match the URL exactly, so if you're visiting www.7thgradeplay.org, the bucket also needs to be named www.7thgradeplay.org.
Similarly, the DNS record for "www.7thgradeplay.org" must be a CNAME to "c.storage.googleapis.com.".
Checking DNS, I see a CNAME from "wwww.7thgradeplay.org" to "7thgradeplay.org". It needs to be "c.storage.googleapis.com." If you've already set that, you may need to wait a while for it to percolate. DNS can be slow to update.
回答2:
Follow below steps to Host Static Website on Google Cloud Storage.
Creating a CNAME record in DNS :
Go to your respective Domain Service provider account and find DNS settings and Create a
CNAMErecord that points toc.storage.googleapis.com.NAME TYPE DATA www.example.com CNAME c.storage.googleapis.comAfter adding “CNAME” record it will take some time to propagate this records.
Creating a Cloud Storage Bucket :
Go to Google cloud Console and select
Storagefrom side menu, And click onCreate bucket.Now create a bucket whose name must matches the
CNAMErecord that you have created for your domain in DNS settings.For example, If you added a
CNAMErecord pointingwww.example.comtoc.storage.googleapis.com, then create a bucket with the namewww.example.com.
Uploading files to Cloud Storage Bucket :
Now In the list of buckets, click on the name of the bucket that you have created.
Now create
index.htmlfile in your local system for your website home page.Now click on
Upload filesbutton and selectindex.htmlfile that you have created.
Browse the static website :
Now browse your website with your domain name in your web browser.
For example, If your domain name is
www.example.comthen browse your website by going tohttp://www.example.comin your web browser.Now, You have successfully hosted your website on Google Cloud Storage.
来源:https://stackoverflow.com/questions/46410676/how-to-host-a-static-website-on-google-cloud-storage