Customize Hosts file (Website Preview)

If you are creating a new website, but do not want it to go live yet, it is possible to test your website locally. This is possible by making a (temporary) adjustment to the hosts file on your computer. This modification directs the domain name you enter to a specific IP address, instead of the IP address determined by the DNS.

Note: This adjustment is per computer and always results in an SSL warning. Alternatively, you can use a subdomain (Plesk: Adding subdomain or domain aliases) and then make a DNS adjustment so that the subdomain is redirected to our server ip address (Plesk: Where can I find my server name and ip address?).


Modify hosts file Windows

For Mac/Apple see below (link).

  1. Open Notepad as administrator
    • Click on the Windows key and search for “Notepad”.
    • Right-click on Notepad and choose Run as administrator.
      mceclip0.png
  2. Open the hosts file
    • In Notepad, click in the upper left corner on File, Open.
    • Under Filename enter the following path “c:\windows\system32\drivers\etc\hosts” and click Open.
      mceclip7.png
  3. Enter the ip address of the server and the domain name you want to see that resides on that server. Note: In our example we use the ip 45.82.191.123 and the domain cloud86example.com, replace these with your server ip address and domain name.
  4. After you make the change, save the hosts file (hotkey ctrl + S) and you can use the browser to test your website locally. Once your site has been successfully tested, you can delete the rules you added in the hosts file.

Modify hosts file Mac/Apple

  • Open Terminal (MacTerminal.jpg), you can search for this in Spotlight (cmd + spacebar)
  • Type “sudo nano /etc/hosts” and press enter to open the hosts file.
  • Enter your password from the Mac and press enter. Note: no characters appear in the terminal when entering the password.
  • Enter the ip address of the server (Plesk: Where can I find my server name and ip address?) and the domain name you want to see that is on that server.
  • Save the file with the key combination Control + X, press Y and then Enter.

Example hosts file lines:

Below is an example host files with the added lines for the domain cloud86example.com, replace this domain with the domain that you want.

##
# Host Database
#
# localhost is used to configure the loopback interface
# when the system is booting. Do not change this entry
##
127.0.0.1         localhost
255.255.255.255   broadcasthost
:::1              localhost

# Added lines
45.82.191.123 cloud86example.com
45.82.191.123 www.cloud86example.com


If you need some help, you can always reach our support desk by email support@cloud86.io and on weekdays from 10:00 am to 4:00 pm you can also reach us by phone and via the chat in My Cloud86.