[英]How to setup domain & its sub domain to different Firebase hosting projects
Suppose my domain is mydomain.com
, and subdomain subdomain.mydomain.com
. 假设我的域名是mydomain.com
,子域名是subdomain.mydomain.com
。 I got it from Godaddy. 我是从Godaddy得到的。
What I want 我想要的是
I want to run different websites on each. 我想在每个网站上运行不同的网站。
mydomain.com
-> Website 1 mydomain.com
- >网站1
subdomain.mydomain.com
-> Website 2 subdomain.mydomain.com
- >网站2
How I setup so far 到目前为止我的设置方式
Website 1
is hosted on Firebase project 1
and accessible via default URL firebase-projectid.firebaseapp.com
. Website 1
托管在Firebase project 1
,可通过默认URL firebase-projectid.firebaseapp.com
访问。
Website 2
is hosted on Firebase project 2
and accessible via default URL. Website 2
托管在Firebase project 2
,可通过默认URL访问。
Both Firebase projects are on same Google account. 两个Firebase项目都在同一个Google帐户中。
What I have done successfully so far 到目前为止我成功完成了什么
I started with mydomain.com
-> Website 1 我从mydomain.com
开始 - >网站1
Verified domain by adding TXT record provided by Firebase project 1
. 通过添加Firebase project 1
提供的TXT记录验证域名。
Added couple of A records to point domain to Firebase project 1
hosting. 添加了几个A记录到指向Firebase project 1
托管的域。
So far so good, and mydomain.com
is working fine. 到目前为止mydomain.com
顺利, mydomain.com
工作正常。
What is not working 什么不起作用
Now I want to host subdomain.mydomain.com
-> Website 2 with Firebase project 2
. 现在我想用Firebase project 2
托管subdomain.mydomain.com
- > Website Firebase project 2
。
I started with custom subdomain, added subdomain.mydomain.com
. 我从自定义子域开始,添加了subdomain.mydomain.com
。 Firebase had already verified domain and directly provided me ip address for A records. Firebase已经验证了域名并直接为我提供了A记录的IP地址。 I added both A records on my domain registrar. 我在我的域名注册商处添加了两条A记录。
As far as I understand, these are only steps needed. 据我了解,这些只是需要的步骤。 But subdomain.mydomain.com
is not working and Firebase still shows status of subdomain as Needs Setup
. 但是subdomain.mydomain.com
无效,Firebase仍然显示子域的状态为Needs Setup
。
Observations 意见
Two things I observed seems strange to me. 我观察到的两件事对我来说似乎很奇怪。
mydomain.com
and subdomain.mydomain.com
are same. Firebase为两个项目mydomain.com
和subdomain.mydomain.com
提供的IP地址相同。 Not sure if this is normal or not. 不确定这是否正常。 subdomain.mydomain.com
with A records, is not propagating when checked on https://dnschecker.org/
. 在https://dnschecker.org/
选中时,带有A记录的subdomain.mydomain.com
不会传播。 However, if subdomain is added via Godaddy Forwarding option, then it start propagating in few minutes. 但是,如果通过Godaddy Forwarding选项添加子域,则它会在几分钟内开始传播。 Questions 问题
subdomain.mydomain.com
is not propagating. 知道为什么subdomain.mydomain.com
没有传播。 I checked just after 10 mins. 我在10分钟后检查了一下。 May be I need to wait longer? 可能我需要等待更长时间? I tried exploring other threads but couldn't understand what I am doing wrong. 我试过探索其他线程,但无法理解我做错了什么。 Any help will be appreciated. 任何帮助将不胜感激。
After scratching my head for few more hours I found issue at Godaddy side. 在我挠了几个小时之后,我在Godaddy那边找到了问题。 While adding subdomain A record, I was providing host as subdomain.mydomain.com
, which was wrong. 在添加子域A记录时,我提供的主机为subdomain.mydomain.com
,这是错误的。
Instead of subdomain.mydomain.com
host should have been subdomain
only. 而不是subdomain.mydomain.com
主机应该只是subdomain
。 After updating host it started propagating in few seconds, and status on Firebase is Pending
. 更新主机后,它在几秒钟内开始传播,Firebase上的状态为Pending
。 After a minute, subdomain.mydomain.com
is working fine. 一分钟后, subdomain.mydomain.com
工作正常。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.