4
  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.

2 Answers 2

6

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.

1

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.

You must log in to answer this question.

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