通过 NameCheap 设置托管在 AWS 上的子域时遇到问题

Having trouble setting up subdomain hosted on AWS, through NameCheap

我在 Namecheap 上买了一个便宜的域名。它托管在 AWS EC2 Linux Ubuntu 实例上。我通过 Route 53 设置它。根域工作正常。

我想做的是让一个子域正常工作,例如 apex.rootdomain.com,但我遇到的麻烦比我想象的要多得多。我认为这比设置根域要容易得多(由于我发现了一篇很棒的文章,这实际上非常简单)。

这是我的apache2.conf:

<Directory /html/root>
        Options FollowSymLinks
        AllowOverride None
        Require all granted
</Directory>

<Directory /html/apex>
        Options FollowSymLinks
        AllowOverride None
        Require all granted
</Directory>

这是我在 etc/apache2/sites-available/MyConfig.conf 中的配置文件:

<VirtualHost *:80>

        ServerAdmin webmaster@localhost
        DocumentRoot /html/root
        ServerName www.root.com
        ServerAlias root.com

        ErrorLog ${APACHE_LOG_DIR}/error.log
        CustomLog ${APACHE_LOG_DIR}/access.log combined
</VirtualHost>

<VirtualHost *:80>
        ServerName apex.root.com
        DocumentRoot "/html/apex"
</VirtualHost>

我相信我的 apache2.conf 和 MyConfig.conf 都是正确的,因为它们适用于我的主域。

以下是我在 Route 53 上设置子域的方法:

  1. 我为我的子域创建了一个托管区域。
    • 这导致了 NS 和 SOA 记录集。
  2. 然后我去了我的主域名的托管区域。
  3. 我在 root.com
  4. 的托管区域中为 apex.root.com 创建了一条新的 NS 记录
  5. 我把步骤(1)的4个地址复制粘贴到步骤(3)的记录集中
  6. 我将 (4) 中的地址复制并粘贴到我的 Namecheap 仪表板的 'Name Servers' 中。我现在在 Namecheap 中总共有 8 个名称服务器地址(4 个用于根域,4 个用于子域)

编辑

补充一下,我等了大约 2 或 3 天,只是想看看问题是否会自行解决,但没有。 Namecheap 说更改生效需要不到 48 小时。

编辑:区域文件

root.com

的托管区域
NAME                               TYPE    VALUE
root.com.                            A      Elastic-IP


root.com.                            NS   Domain-Name-A.
                                          Domain-Name-B. 
                                          Domain-Name-C. 
                                          Domain-Name-D.

root.com.                           SOA   some values that I don't think matter

www.root.com.                         A   Elastic-IP
apex.root.com                         A   Elastic-IP

域名服务器:域名-A、域名-B、域名-C、域名-D、域名-E、域名-F、域名-G、域名-H 在 Namecheap 上被列为 'Name Servers'。

这是我的 Namecheap 设置的样子:

NameServers

Customs DNS
- Domain-Name-A
- Domain-Name-B     
- Domain-Name-C
- Domain-Name-D  

假设 root.com 和 www.root.com 在您当前的配置中工作,它将如下所示:

root.com.                            A      Elastic-IP
www.root.com.                        A      Elastic-IP
apex.root.com.                       A      Elastic-IP

请记住,在 GoDaddy 上,您的 DNS 将如下所示:

@                                    A      Elastic-IP
www                                  A      Elastic-IP
apex                                 A      Elastic-IP