M3Server Technical Blog Mini Howto Mini Howto: Preview site on new server before updating dns

Mini Howto: Preview site on new server before updating dns

Senario:

You have a live site elsewhere that you are moving to M3 (thanks!), but want to see how the site looks before updating dns?  No problem!

Edit your computer’s host file!

windows path:

C:\WINNT\system32\drivers\etc\hosts

Windows Command:

for windows Vista and Windows 7
Click Start – search for “Notepad“, right-click and select “Run as Administrator“. This should launch notepad with elevated privileges. Now, open the host file from the File menu, edit and save.

Mac OS X and most Linux Operating system’s path:

/etc/hosts

MAC/LINUX COMMAND:

Launch terminal:  click on applications > utilities > terminal

sudo nano /etc/hosts

Open the hosts file with notepad, nano, vi, or any other plain text editor (not word or wordpad).

Revise the example below with your correct information and enter this line on the bottom of your hosts file:
216.177.153.2  www.your_site.com your_site.com alias_names.com other_site2.com www.other_site2.com

The above line is not meant to line wrap, it is all on one line – very important.

IMPORTANT Do not add your test IP to more than one line. If you have 100s of domains that you want to test, they all need to be listed on a single line. Otherwise, the IP at the bottom of the list will over rule the entries for that IP above it.

NOTE: the above IP address and web site are an example only. Enter your site’s new IP address and your domain name(s) in place of the provided example. If you don’t know the IP of your server, you can find the list of IPs and domain names in your M3Admin Server Control Panel.

Make sure there is a tab or a space between the ip and the domain name, and a space between each domain name.  Save the file.  Restart your browser, and you will now see the site on your server.  Quick and simple.  I make a shortcut of my hosts file on my desktop as I do this often.

Restart your browser, you can now view your site on the new server for testing before updating the DNS servers at your domain registrars. Sometime’s browsers will be stubborn about caching your domain name to the old ip. To make certain, upload a test file or a file that you know has changed on the new server and verify it displays accurately in your browser.

– M3Server.com managed virtual servers

Leave a Reply