Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

I am currently using apache on linode to host my website. I am using a number of sub-domains each of which is accessible only with non-www url. www url gives 503 error.

However, I wish my domains to be accessible from both type of urls. A typical config for making a virtual site looks like this :-

<VirtualHost *:80>
  # Admin email, Server Name (domain name), and any aliases
  ServerAdmin atiprashant@xyz.com
  ServerName  www.mobiles.xyz.com
  ServerAlias mobiles.xyz.com

  # Index file and Document Root (where the public files are located)
  DirectoryIndex index.html index.php
  DocumentRoot /home/prashant/public/xyz.com/public/mobiles

  # Log file locations
  LogLevel warn
  ErrorLog  /home/prashant/public/xyz.com/public/mobiles/log/error.log
  CustomLog /home/prashant/public/xyz.com/public/mobiles/log/access.log combined
</VirtualHost>

A/AAAA records at linode looks like this :- enter image description here

Can anyone suggest me what is wrong in my approach ? Please comment if I am unclear in asking my doubt.

thanks !

share|improve this question
    
There is no record for www.mobiles defined in your screenshot. –  Andrew B Jun 22 '13 at 15:20
    
Ohh ! Do I need to make a separate one here also ? –  Prashant Singh Jun 22 '13 at 15:27
    
Correct. If you want wildcard-like behavior (i.e. "everything under mobiles should go to this IP address"), you have to explicitly define it. (*.mobiles) –  Andrew B Jun 22 '13 at 15:32
    
OK ! Thanks a lot. I am trying that :) –  Prashant Singh Jun 22 '13 at 15:33

1 Answer 1

up vote 4 down vote accepted

DNS will not automatically provide records that fall beneath a subdomain that you have defined. (i.e. www.mobiles will return NXDOMAIN even if you have defined mobiles)

There are two ways to fix this:

  1. Explicitly define all DNS records that you expect people to be requesting. This is the normal approach. mobiles and www.mobiles would have their own DNS records.
  2. Create a separate wildcard DNS record called *.mobiles. This will match the records that fall beneath mobiles. Make sure you leave your existing mobiles DNS record in place as the wildcard will not match the base name.
share|improve this answer
    
Thanks Andrew ! All of my subdomains are working now, but the issue is main domain is not working with www. All www.xyz.example.com working but www.example.com not working. What can be the possible issues ? –  Prashant Singh Jun 23 '13 at 0:07
    
Your screenshot shows that you are missing a DNS record for www. All of your DNS records must be explicitly defined unless they would be provided by a wildcard. (as explained above) –  Andrew B Jun 23 '13 at 20:25

Your Answer

 
discard

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.