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

I'm migrating to a new server and would like to test before redelegating the domain over. I have some familiarity with setting up apache virtual hosts, but limited knowledge.

How can I go about setting this up? My server already has a domain delegated to the server, and the IP by default has been setup to point to that.

I've been told I can just add an entry to /etc/hosts/ which I haven't been able to understand what I can add in there to make this work.

Any pointers would be greatly appreciated!

share|improve this question
So you want to test the deployment before making the DNS entry? – Somantra Jul 9 '12 at 21:09
@Somantra, yes exactly. – willdanceforfun Jul 9 '12 at 21:10
+1 pun-points for Any Pointers – Somantra Jul 9 '12 at 21:22
What do you mean by "domain delegated to the server"? Do you mean there's an A record that's pointing to the server's IP? – gravyface Jul 9 '12 at 21:48
Yes, thats right. – willdanceforfun Jul 10 '12 at 6:38
up vote 6 down vote accepted

Here is a more detailed tutorial on creating hosts file entries.

The short answer is to make an entry in the file (c:\windows\system32\drivers\etc\hosts) that follows the pattern of IP [tab] Host(s):

On a Mac or Linux desktop, this file is at /etc/hosts.

This should be done on the client machine from which you will test the new server. Once you have put it into production and your new DNS records have propagated, you can safely remove the entry.

share|improve this answer
So I should be editing this /etc/hosts on my own computer and merely point it to the IP address of the server? I hadn't thought of that! I don't think I have conveyed though properly if I load up the IP of the server that it loads up an existing site I have on the same server. How can I control what web directory loads up by default when I try to connect to the IP? – willdanceforfun Jul 10 '12 at 6:40
@cosmicbdog,That would be the VirtualHost directive, see here: Contains directives that apply only to a specific hostname or IP address – Somantra Jul 11 '12 at 19:16

The simplest solution, in my mind, would be to create a dns entry such as and point it to your new ip. In httpd.conf, add


to your virtualhost config. reload named and httpd and point your browser to

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.