简体   繁体   English

Static GCS 网站存储桶和 http 根域无法正常工作

[英]Static GCS Website bucket and http root domain not workiing

I created a GCS bucket www.example.com and have setup a CNAME record with my DNS provider (DNSimple) to point at c.storage.googleapis.com . I created a GCS bucket www.example.com and have setup a CNAME record with my DNS provider (DNSimple) to point at c.storage.googleapis.com . I can now access my domain with www but also want to make the root domain point at the bucket.我现在可以使用www访问我的域,但也希望将根域指向存储桶。 Reading through threads on the same subject this seems to be possible with a synthetic record (google domains) or ALIAS record (other dns providers).通过合成记录(谷歌域)或别名记录(其他 dns 提供者)似乎可以阅读同一主题的线程。 I don't seem to be able to get this to work with DNSimple though so was wondering if anyone can spot my error?我似乎无法让它与 DNSimple 一起使用,所以想知道是否有人能发现我的错误?

I get the following error when accessing the root domain:访问根域时出现以下错误:

<Error>
<Code>NoSuchBucket</Code>
<Message>The specified bucket does not exist.</Message>
</Error>

I set my ALIAS record to point my root domain example.com at www.example.com but still no luck.我将我的 ALIAS 记录设置为指向www.example.com的根域example.com但仍然没有运气。 So basically the below two records:所以基本上以下两条记录:

ALIAS   example.com www.example.com
CNAME   www.example.com c.storage.googleapis.com

Am I missing something or is this a limitation of DNSimple as this apparently seems to work with Google Domains (after reading through other questions)?我是否遗漏了什么,或者这是 DNSimple 的限制,因为这显然似乎适用于 Google Domains(在阅读了其他问题之后)?

Just to add the bit from the Google documentation which states the same:只是从谷歌文档中添加一点相同的内容:

Note: DNS does not support creating a CNAME record on a root domain, such as example.com, so in most cases, you must create your CNAME record on a subdomain, such as www.example.com or myblog.example.com. Note: DNS does not support creating a CNAME record on a root domain, such as example.com, so in most cases, you must create your CNAME record on a subdomain, such as www.example.com or myblog.example.com. Some DNS providers offer a non-standard feature that allows a root domain to be aliased to another name without the use of CNAME.一些 DNS 提供程序提供非标准功能,允许在不使用 CNAME 的情况下将根域别名为另一个名称。 Consult your DNS provider documentation to determine if such a feature is available.请查阅您的 DNS 提供程序文档以确定此类功能是否可用。

I am not highly familiar with GCS, as I've used AWS for the same purpose.我对 GCS 不是很熟悉,因为我将 AWS 用于相同目的。 However, there's a few recommendations:但是,有一些建议:

  1. Make sure to verify the domain确保验证域
  2. Make sure you have both the www and apex associated to the bucket/configuration.确保您同时拥有与存储桶/配置相关联的 www 和 apex。 This is often the missing step.这通常是缺少的步骤。 www.example.com and example.com are two different hostname, if you point both DNS records to Google but you configure only www.example.com in your Google Account, then the apex won't work (which may be your scenario). www.example.com and example.com are two different hostname, if you point both DNS records to Google but you configure only www.example.com in your Google Account, then the apex won't work (which may be your scenario) .

Finally, I recommend you configure the ALIAS to point to the target ( c.storage.googleapis.com ) and not to the www local hostname.最后,我建议您将 ALIAS 配置为指向目标( c.storage.googleapis.com )而不是 www 本地主机名。

This was simpler than I thought.这比我想象的要简单。 Instead of adding an ALIAS record I had to add an URL record pointing example.com at http://www.example.com to make the redirect work. Instead of adding an ALIAS record I had to add an URL record pointing example.com at http://www.example.com to make the redirect work.

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM