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?


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  domain.com
| 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 xyz.com and abc.com , files of both sites are saved in /var/www/vhosts/xyz.com & /var/www/vhosts/abc.com Now please tell me what should I write in my hosts file – vinayrks Mar 25 '10 at 13:05
  • x.x.x.x abc.com xyz.com ... – Cry Havok Mar 25 '10 at 13:09
  • x.x.x.x abc.com 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 Cogan 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.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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