将Google Domain链接到Amazon ec2服务器 [英] link a Google Domain to Amazon ec2 server
问题描述
我正在使用Amazon EC2实例来服务node.js应用程序。我最近通过)打开DNS设置
- 名称:在在这种情况下,我们要使用 @或 www
-
@
是根记录(或没有特别设置的内容)[全部] -
www
是人们键入www.example时的记录。 .com
-
- 类型:有两种类型:
A
表示IPv4地址,AAAA
表示IPv6地址
- 您可以分别设置它们,通常要使用
A
[IPv4]
- 您可以分别设置它们,通常要使用
- TTL:生存时间,建议离开
1hr
(这是高级属性) - 数据:您要指向的实际IP地址(您的网站)
- 示例:
8.8.8.8
[Google名称服务器]
- 示例:
- 这大约需要花费时间。 1小时(只要您将TTL保持在
1小时
)
- 此步骤可能需要更长的时间,具体取决于Google的服务器
- 检查您的网站
www.example.com
以确认其已更新
I am using an Amazon EC2 instance to serve a node.js app. I recently purchased a domain name through Google Domains and I want to use that domain name to access my node.js app.
The Google Domains console allows you to forward your domain traffic to another website. I set it to forward traffic to the public IP address of my EC2 instance. I can access my app just fine now, but when I type www.myDomainName.com
into a web browser, the URL bar immediately changes and displays the digits of my EC2 IP address.
I would like the URL bar to display the name of my domain instead.
Note:
I have read a few SO questions related to this and can't figure it out. Some of them are a bit over my head. Many of them say to use an Amazon Elastic IP, but I don't understand why this is necessary if the public IP of my EC2 instance seems to work just fine. If the solution here is to use Amazon Elastic IP, I would really appreciate an explanation as to why that is necessary,
It sounds like you are using Google Domains to redirect to another site once the request has hit the Google servers. This is fine and dandy if you have another domain you are wanting to redirect to.
If you want it to stay under your domain name, but point to another location you need to actually change the DNS entries for your domain.
Go to Google Domain services and change your master(*) (A) record, as well as your WWW (A) record, to point at your public IP address. That way when a DNS request is sent for your domain it will just ask Amazons' servers what to do instead of using a redirect from Google.
Exact Steps:
- From the Google Domain Website, click the Middle Tab () to open DNS settings
- Fill out the form near the bottom of the page titled, Custom Resource Record
- Name: In this scenario we want to use "@" or "www"
@
is the root record (or anything not specifically set)[all]www
is the record for when people typewww.example.com
- Type: There are two types;
A
refers to IPv4 address andAAAA
refers to IPv6 address- You can set both of them separately, generally you want to use the
A
[IPv4]
- You can set both of them separately, generally you want to use the
- TTL: Time to live, recommend leaving
1hr
(this is an advanced attribute) - Data: The actual IP address you are wanting to point to (your website)
- Example:
8.8.8.8
[Google Nameserver]
- Example:
- Name: In this scenario we want to use "@" or "www"
- Now that are the blanks are filled out, press the "Add" button
- Wait for the records to be updated publicly
- This will take approx. 1hr (as long as you kept TTL at
1hr
)- This step can take longer depends on Google's servers
- Check your website
www.example.com
to confirm it has updated
- This will take approx. 1hr (as long as you kept TTL at
这篇关于将Google Domain链接到Amazon ec2服务器的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!