Webmasters Stack Exchange is a question and answer site for pro webmasters. 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

I have a dedicated server and a mydomain.com (bought from a hosting company). I want to host a website from my dedicated server with the domain mydomain.com i.e. when I enter mydomain.com from browser it should point to the IP(let's say X.X.X.X) of dedicated server(and a particular folder inside it). I have some following queries:

In Server

  1. I know I need to edit some of the files (like: host or hostname file) in the server but I do not know what exact file I need to edit.
  2. How to add a Site enable or Site available in apache2 ?

In Hosting Company control Panel

  1. Which records to add (A or cname or anyother)?
  2. Where Should I add DNS(in dedicated server section or domain name section)?
  3. How it is going to affect the behaviour of the domain?

in short the question is: How the virtual host works & how to add DNS?

share|improve this question

migrated from superuser.com Sep 11 '12 at 9:33

This question came from our site for computer enthusiasts and power users.

Firstly setup a A record to the IP address of your server. You need not add any DNS entries.

You then have to set up Virtual Hosts in Apache, refer here or here. While setting up virtual hosts, select the folder as per your needs.

share|improve this answer
Does it not matter where the nameserver records are as to if the OP needs to set up the DNS on his/her server or on the registar's server (I've not used Apache so this is how I did it)? – Dave Sep 11 '12 at 8:10
There is no need for DNS entry, updating the A record of the domain name is enough – HackToHell Sep 11 '12 at 8:14
Cool, so it is the same regardless - I guess it would be. @Subhransu Just to clarify the only real reason to move the name server to your own server is due to very complex set ups or (as in my case) faults with the server's nameserver records! – Dave Sep 11 '12 at 8:19

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.