无法通过NameCheap设置托管在AWS上的子域

时间:2019-01-30 03:36:59

标签: amazon-web-services apache2.4 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>

我相信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,域名- Name-H在Namecheap上被列为“名称服务器”。

这是我的Namecheap设置的样子:

NameServers

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

1 个答案:

答案 0 :(得分: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