0

I have an Amazon EC2 Debian instance running NGINX.

I can reach "www.mydomain.com" just fine. however, despite modifying the web server (NGINX) configuration to support "subdomain.mydomain.com" -- it's unreachable from outside.

I try to curl (of course I'm replacing my real subdomain with "subdomain.mydomain.com" in the output)

curl -v subdomain.mydomain.com

output:

* 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
< 

From this point I get the verizon FIOS "Sorry we can't find your page"

* 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>

My suspicion is that the "subdomain" domain isn't configured on my Debian DNS. How do I do that? on the virtual machine itself? on EC2 somewhere?

JasonGenX
  • 522
  • 1
  • 5
  • 16

2 Answers2

1

If you're hosting your own DNS server, simply add a CNAME Record to your zone file to make your subdomain resolvable, like this:

subdomain             IN      CNAME   mydomain.com.

If your DNS server is hosted by AWS or whatever then use their interface to add the record.

Nabil Bourenane
  • 755
  • 4
  • 11
-1

Accepted answer is not full. See why here Setup CNAME for subdomain issue

Now shortly, simple DNS map:

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

In that case - www.somehost.com and subdomain.somehost.com would pointing to somehost.com and will server same content, while subdomain1.somehost.com could serve different content on the same host with "virtual server" feature, if they is supported by server.

Reishin
  • 101
  • 3
  • All the different names in your example resolve to the same address, there's no way to say which names would get the same content when used in an http request without having seen the web server config. A `CNAME` does not affect the `Host` header in any way. – Håkan Lindqvist Mar 30 '15 at 17:26