将 Google 域链接到 Amazon ec2 服务器 [英] link a Google Domain to Amazon ec2 server
问题描述
我正在使用 Amazon EC2 实例为 node.js 应用程序提供服务.我最近通过 ) 打开 DNS 设置
- 名称:在这种情况下,我们要使用@"或www"
@
是根记录(或任何未特别设置的内容)[all]www
是人们输入www.example.com
的记录
- 类型:有两种类型;
A
表示 IPv4 地址,AAAA
表示 IPv6 地址- 两者都可以分别设置,一般要使用
A
[IPv4]
- 两者都可以分别设置,一般要使用
- TTL:生存时间,建议离开
1hr
(这是一个高级属性) - 数据:您要指向的实际 IP 地址(您的网站)
- 示例:
8.8.8.8
[Google 域名服务器]
- 示例:
- 这将需要大约.1 小时(只要您将 TTL 保持在
1hr
)- 此步骤可能需要更长时间,具体取决于 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 域链接到 Amazon ec2 服务器的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!