azure - 如何将我的 GoDaddy 域连接到 Azure VM 服务器?

标签 azure dns cname nameservers a-records

我继承了一个带有运行 Web 服务器的 CentOS 的 Azure VM。我可以通过端口 8080 的 IP 地址(我们称之为 12.34.567.890:8080)来访问它。

我在 GoDaddy 注册了域名 example.app。现在我需要将它们连接起来。我意识到我需要设置 DNS 记录,但我不确定是否将 GoDaddy 上的名称服务器更改为 Azure 上的名称服务器,然后在 Azure 上设置 DNS 区域,或者是否将名称服务器保留在GoDaddy 并在那里设置 DNS 区域以指向 Azure(后者是当前的设置方式)。我已经尝试了一些方法,但到目前为止还没有任何乐趣。

目前似乎两者兼而有之(在我之前有人做过这个工作,我不确定这两种情况的默认值是什么)。

因此,在 GoDaddy 我们有:

    Using Default name servers:
    ns77.domaincontrol.com
    ns78.domaincontrol.com

    A records:
    @   12.34.567.890 (the IP of the Azure server)
    *   12.34.567.890

    CNAME:
    www    @

    NS:
    @   ns77.domaincontrol.com
    @   ns78.domaincontrol.com

    SOA:
    @   Primary nameserver: ns77.domaincontrol.com

我可以编辑 A 和 CNAME 记录,但不能编辑 NS 或 SOA 记录。

在 Azure(在 DNS 区域)我有:

Resource group: www.example.app
Name Server 1: ns1-04.azure-dns.com
Name Server 2: ns2-04.azure-dns.net
Name Server 3: ns3-04.azure-dns.org
Name Server 4: ns4-04.azure-dns.info

Name    Type   TTL      Value                      Alias resource type      Alias target

@       A      3600     -                          Public IP Address        example-prod-ip

@       NS     172800   ns1-04.azure-dns.com.
                        ns2-04.azure-dns.net.
                        ns3-04.azure-dns.org.
                        ns4-04.azure-dns.info.

@       SOA    3600     Email: azuredns-hostmaster.microsoft.com
                        Host: ns1-04.azure-dns.com.
                        Refresh: 3600
                        Retry: 300
                        Expire: 2419200
                        Minimum TTL: 300
                        Serial number: 1

我再次必须选择编辑或删除 A 记录,但不能选择其他记录。

如果我尝试通过浏览器访问该域,我会得到以下信息:

Using 12.34.567.890:8080 - works fine
Using 12.34.567.890 - "Safari can't open the page because the server isn't responding"
Using example.app or www.example.app or http://www.example.app - "Safari can't open the page because Safari can't establish a secure connection to the server"

我不知道域名“example.app”是否也会产生影响。接下来我可以尝试什么?

最佳答案

首先,默认情况下,Web 浏览器通过 HTTP 端口 80 或 HTTPS 端口 443 访问 Web 服务器。如果您使用非默认端口 8080,则需要在访问网站时添加端口,例如http://12.34.567.890:8080http://www.example.app:8080http://example.app:8080 >.

您可以选择使用 Azure DNS 托管您的域,但这不是必须要做的事情。您的域名仍在 GoDaddy 上注册。一旦你host your domain in Azure DNS ,您需要将 Azure 名称服务器添加到您的域注册器,而不是使用 GoDaddy 中的默认名称服务器。在我的印象中,在 Azure DNS 中托管域名后,您无法在 GoDaddy 中编辑记录。

然后,要将自定义域映射到您的网站,您需要在域 DNS 区域中添加 ACNAME 记录。对于 A 记录,您需要添加 @*(类型为 A)并指向虚拟机的公共(public) IP 地址。对于 CNAME 记录,您需要添加 CNAME 类型的 www 并指向虚拟机的 FQDN 名称。请参阅creating a FQDN .

最后,在本例中,我发现您在域提供商中获得了正确的 A 记录配置。这应该有效。无需再创建 Azure DNS 区域。所以你使用 12.34.567.890:8080 没问题。使用其他浏览器访问网站时,只需添加8080端口即可。如果您不想每次都添加端口,可以更改Web服务器监听端口,并通过 network security group 限制有限源IP访问的网站。连接到 Azure VM 的子网。

A records:
    @   12.34.567.890 (the IP of the Azure server)
    *   12.34.567.890

关于azure - 如何将我的 GoDaddy 域连接到 Azure VM 服务器?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/61248392/

相关文章:

azure - 了解 Azure 云服务防火墙

dns - 为什么会出现 No name servers found at child 错误?

java - Android - 解析 RSS 提要时出现 UnknownHost 异常

php - Azure PHP Web 角色,F# 辅助角色 : developing on different machines

Azure DevOps PowerShell - 我可以为库组变量构建变量字符串吗

Azure Active Directory 作为 Azure 虚拟机的域 Controller

docker - Kubernetes DNSPolicy配置

dns - Google Cloud DNS 中的 CNAME

azure - 如何设置 Azure CNAME