Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.
  1. Lets say I run a webserver, apache.
  2. I have a domain known as example.com.
  3. The name servers and such are correctly configured for example.com to resolve to the IP of the webserver, which serves the root directory of the webserver when example.com is requested.

I want to setup a subdomain like so: dev.example.com
I know how to do this in the httpd.conf (tested it with dev.localhost etc).

My question is, is the subdomain 'dev' handled strictly by apache when it is requested, just like example.com/dev/ would be? I want to know if I need to change anything DNS related so that dev.example.com would resolve. Does the DNS have a play in this or is it strictly handled by apache?

It's worth noting that I use a free dns provider known as zoneedit.

Thanks.

share|improve this question
add comment

2 Answers

up vote 2 down vote accepted

You have to create either an A record or a CNAME for dev.example.com in your DNS (or a wildcard record for *.example.com). Apache can't do anything with requests for dev.example.com if they can't get to your web server, which they can't do unless there's a DNS record that resolves for dev.example.com.

share|improve this answer
add comment

Two steps -

  1. Set up an A record at your DNS manager, at the control panel of your domain registrar. Point dev.example.com to your server IP.
  2. Create a VirtualHost record in your Apache configuration. Read more here. Point it to any directory you want.
share|improve this answer
add comment

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.