“www.mydomain.com”可访问,“subdomain.mydomain.com”不可达

“www.mydomain.com”可访问,“subdomain.mydomain.com”不可达

我有一个运行 NGINX 的 Amazon EC2 Debian 实例。

我可以正常访问“www.mydomain.com”。但是,尽管修改了 Web 服务器(NGINX)配置以支持“subdomain.mydomain.com”,但从外部仍然无法访问。

我尝试卷曲(当然,我在输出中用“subdomain.mydomain.com”替换了我的真实子域名)

curl -v subdomain.mydomain.com

输出:

* Rebuilt URL to: subdomain.mydomain.com/
* Hostname was NOT found in DNS cache
*   Trying 92.242.140.21...
* Connected to subdomain.mydomain.com (92.242.140.21) port 80 (#0)
> GET / HTTP/1.1
> User-Agent: curl/7.37.1
> Host:subdomain.mydomain.com
> Accept: */*
> 
< HTTP/1.1 200 OK
* Server nginx/1.0.15 is not blacklisted
< Server: nginx/1.0.15
< Date: Sat, 21 Mar 2015 20:14:28 GMT
< Content-Type: text/html; charset=UTF-8
< Transfer-Encoding: chunked
< Connection: close
< Cache-control: no-cache, no-store
< Expires: Thu, 01 Jan 1970 00:00:00 GMT
< Pragma: no-cache
< 

从此时起,我收到了 Verizon FIOS 的“抱歉,我们找不到您的页面”

* Closing connection 0
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html><head><meta http-equiv="refresh" content="0;url=http://searchassist.verizon.com/main?InterceptSource=0&ClientLocation=us&ParticipantID=euekiz39ksg8nwp7iqj2fp5wzfwi5q76&FailureMode=1&SearchQuery=&FailedURI=http%3A%2F%2Fsubdomain.mydomain.com%2F&AddInType=4&Version=2.1.8-1.90base&Referer=&Implementation=0&method=GET"/><script type="text/javascript">url="http://searchassist.verizon.com/main?InterceptSource=0&ClientLocation=us&ParticipantID=euekiz39ksg8nwp7iqj2fp5wzfwi5q76&FailureMode=1&SearchQuery=&FailedURI=http%3A%2F%2Fdsubdomain.mydomain.com%2F&AddInType=4&Version=2.1.8-1.90base&Referer=&Implementation=0&method=GET";if(top.location!=location){var w=window,d=document,e=d.documentElement,b=d.body,x=w.innerWidth||e.clientWidth||b.clientWidth,y=w.innerHeight||e.clientHeight||b.clientHeight;url+="&w="+x+"&h="+y;}window.location.replace(url);</script></head><body></body></html>

我怀疑我的 Debian DNS 上没有配置“子域”域。我该怎么做?在虚拟机本身上?还是在 EC2 的某个地方?

答案1

如果您托管自己的 DNS 服务器,只需向您的区域文件添加 CNAME 记录即可使您的子域名可解析,如下所示:

subdomain             IN      CNAME   mydomain.com.

如果您的 DNS 服务器由 AWS 或其他机构托管,则使用其界面添加记录。

答案2

接受的答案不完整。请在此处查看原因为子域名设置 CNAME 问题

现在简短介绍一下简单的 DNS 映射:

somehost.com              A    127.0.0.1
www.somehost.com        CNAME somehost.com
subdomain.somehost.com  CNAME somehost.com
subdomain1.somehost.com   A    127.0.0.1

在这种情况下 -www.somehost.comsubdomain.somehost.com会指向somehost.com并将提供相同的内容,而subdomain1.somehost.com如果服务器支持,可以使用“虚拟服务器”功能在同一主机上提供不同的内容。

相关内容