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?


1 Answer 1


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.

  • 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
    Commented Sep 11, 2012 at 8:10
  • There is no need for DNS entry, updating the A record of the domain name is enough
    – HackToHell
    Commented Sep 11, 2012 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
    Commented Sep 11, 2012 at 8:19

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.