Server Fault is a question and answer site for system and network administrators. 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

So I have a main domaing pointing to my server (xx.xx.xx.xx).

I tried to create a subdomain with the following virtualhost file.

<VirtualHost myip:80>

    ServerName  sub.mydomain


<VirtualHost myip:80>


  • I didn't put all the other codes here.

I can't even ping My works just fine.

Am I doing something wrong here?

share|improve this question
up vote 5 down vote accepted

You need a valid DNS record for your subdomain too. You can accomplish this by either setting up an individual DNS entry for each new subdomain, or just creating a wildcard entry for * that is a CNAME to With the whildcard method, you can put in your apache config, and they will all just work without any other configuration. But every namebasedvirtualhost has to have a valid DNS entry.

share|improve this answer

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.