Table of Contents
Editing the hosts file
A common question asked by our customers is how to view their new Simple Hosting website prior to changing the DNS records, so as to not disrupt access to their current website that is hosted elsewhere.
One way of doing this is by modifying the 'hosts' file on your local computer. This allows for your browser to navigate to your Simple Hosting vhost, but does not affect anyone else from accessing your current site.
Gathering the required information
This guide assumes you have the following :
- A Simple Hosting instance
- A vhost, such as www.example.com, attached to your Simple Hosting instance
First, you will need to determine the public IP address of your Simple Hosting instance. From your instance management page, scroll down the Websites section and hover over the Info icon next to your vhost.
You will be shown either a hostname (Ex. gpaas5.dc1.gandi.net.) :
Or an IP address (Ex. 220.127.116.11) :
If hostname, please use the 'ping' command on it to get the IP address, or make a note of the IP address.
Now that you've gathered the required information, you can move onto locating the hosts file on your local computer.
Linux / OS X
For Linux and OS X users, open the Terminal application and type:
sudo nano /etc/hosts
Hit return, and then enter your admin password.
This will open the /etc/hosts file in the nano text editor application.
Using the arrow keys, arrow down to a new line, and then type the IP address, followed by a [TAB], then your vhost address.
Next, press Ctrl + 'X', then press 'Y' and Enter to save.
For Windows users, open Notepad as an Administrator, and then open the following file within Notepad:
Place the cursor on a new line, and then enter the hostname or IP address, followed by a [TAB], then your vhost address.
Save and close the file.
Now you can navigate in your browser to the vhost address, and you will be directed to your Simple Hosting website.
When you're done testing your website, you can simply remove the entry from your hosts file.