Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

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 am doing a Server migration of virtual server (host 15+ sites ), I did all file transfer & other configuration , Now I want to test my sites before actual A record transfer , I know I have to entry in my /etc/hosts file on local computer .Can you give me what exactly i need to write in my /etc/hosts file?

share|improve this question
up vote 2 down vote accepted

Assuming your local computer is a windows machine all you need to do is add a line for each URL you want to test that reads like:

IP Address  Hostname

for example
share|improve this answer
thanks Sam for such a quick reply , But actually More than 15 sites are hosted on the virtual server For example Let assume my ip address is x.x.x.x and 2 site hosted on it are and , files of both sites are saved in /var/www/vhosts/ & /var/www/vhosts/ Now please tell me what should I write in my hosts file – vinayrks Mar 25 '10 at 13:05
x.x.x.x ... – Cry Havok Mar 25 '10 at 13:09
x.x.x.x In this case I am getting apache default page not the site default page – vinayrks Mar 25 '10 at 13:23
@vinayrks well then that's a problem with your Apache. If typing in th hostname is getting you to the server, that is all your host file does. If Apache is not handling the host headers the way you want, then that is a differnt matter. I suggest you start a new question and post your Apache config – Sam Mar 25 '10 at 13:25
OK thanks Sam Cogan, Very very thanks all of you for such a quick and accurate response – vinayrks Mar 25 '10 at 14:24

As Sam said.. it also maybe an idea to create a unique file on the new server that you can goto just to make sure the hosts file update worked. In my experience it can take some minutes, or a new browser window, to goto the manually entered IP.

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.