Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

My server is returning the correct paths for all of my domains as long as they are not prefixed with www. The following is one of my domains in it's simplest form:

<VirtualHost *:80>
  ServerName kyle-o.info
  ServerAlias www.kyle-o.info
  DocumentRoot /home/kyle/www/kyle-o.info

I can provide logs if needed. The server is running Ubuntu:

  Distributor ID:   Ubuntu
  Description:   Ubuntu 12.10
  Release: 12.10
  Codename:   quantal
share|improve this question
Does a DNS lookup on both the www-prefixed name and the non-prefixed name return the same IP? – John Feb 22 '13 at 14:29
up vote 2 down vote accepted

The DNS A record for www.kyle-o.info is absent, so you need to fix the DNS to allow it to work as you expect:

$ dig kyle-o.info any

; <<>> DiG 9.9.2-P1-RedHat-9.9.2-3.P1.fc17 <<>> kyle-o.info any
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 49816
;; flags: qr rd ra; QUERY: 1, ANSWER: 5, AUTHORITY: 3, ADDITIONAL: 4

; EDNS: version: 0, flags:; udp: 4096
;kyle-o.info.           IN  ANY

kyle-o.info.        7200    IN  SOA ns1.digitalocean.com. hostmaster.kyle-o.info. 1360369139 3600 900 1209600 10800
kyle-o.info.        7034    IN  A
kyle-o.info.        7200    IN  NS  ns2.digitalocean.com.
kyle-o.info.        7200    IN  NS  ns1.digitalocean.com.
kyle-o.info.        7200    IN  NS  ns3.digitalocean.com.

kyle-o.info.        7200    IN  NS  ns3.digitalocean.com.
kyle-o.info.        7200    IN  NS  ns1.digitalocean.com.
kyle-o.info.        7200    IN  NS  ns2.digitalocean.com.

ns1.digitalocean.com.   7028    IN  A
ns2.digitalocean.com.   7028    IN  A
ns3.digitalocean.com.   7028    IN  A
share|improve this answer
Isn't the ServerAlias supposed to handle that? – ott-- Feb 22 '13 at 15:28
The ServerAlias lets Apache respond to different names. It doesn't create DNS records. Having the correct DNS record is a prerequisite. – John Feb 22 '13 at 15:31
@ott-- How would it handle a non-existent hostname? Contact the authoritative DNS server and register the name? The provided host name has to be resolvable to be useful. At best, the server could ignore the error and use the alias anyway, but far more common than the web server and outside clients having different ideas of the DNS namespace would simply be a mistype, which this error/warning does alert the administrator to. – Michael Kjörling Feb 22 '13 at 15:33
Thanks for the reply. I thought that @ would point both the domain and www-domain to the same IP? Anyways, I added an A record (not sure if it's done right): kyle-o.info/dns.png – slowBear Feb 22 '13 at 15:38
@slowBear CNAME or A is not important - both will let the thing to work properly (provided CNAME points to the resolvable name). You may add A record or CNAME - it is up to you. There is no standard that enforces you to use CNAME in this case. CNAME simplifies management tasks, but it is not a must. Also, CNAME leads to a subsequent query on the name it points to. – Serge Feb 24 '13 at 12:31

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.