1

我在 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>

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

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

  1. 我为我的子域创建了一个托管区域。
    • 这导致了 NS 和 SOA 记录集。
  2. 然后,我前往托管区域获取我的主域名。
  3. 我在 root.com 的托管区域中为 apex.root.com 创建了一条新的 NS 记录
  4. 我将步骤 (1) 中的 4 个地址复制并粘贴到步骤 (3) 中的记录集中
  5. 我将 (4) 中的地址复制并粘贴到我的 Namecheap 仪表板中的“名称服务器”中。我现在在 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 上被列为“名称服务器”。

这是我的 Namecheap 设置的样子:

NameServers

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

1 回答 1

1

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

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

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

@                                    A      Elastic-IP
www                                  A      Elastic-IP
apex                                 A      Elastic-IP
于 2019-01-30T04:43:44.417 回答