-1

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 !

masegaloeh
  • 18,236
  • 10
  • 57
  • 106
Prashant Singh
  • 125
  • 1
  • 8

1 Answers1

5

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.
Andrew B
  • 32,588
  • 12
  • 93
  • 131
  • 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 00: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