-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 [email protected]
  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 !

3
  • There is no record for www.mobiles defined in your screenshot.
    – Andrew B
    Jun 22, 2013 at 15:20
  • Ohh ! Do I need to make a separate one here also ? Jun 22, 2013 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, 2013 at 15:32

1 Answer 1

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.
2
  • 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 ? Jun 23, 2013 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, 2013 at 20:25

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .