Modifying your hosts file to preview the domain Hosted under Linux – CPanel

To modify the hosts file, you add two entries to the file that contains the IP address that you want the site to resolve to and the address. Adding the following two lines, for example

103.13.242.34(enter server ip) yourdomain.com

103.13.242.34(enter server ip) www.yourdomain.com

The sections in this article provide instructions for locating and editing the hosts file on the following operating systems:

  • 1. Windows 10, Windows 8, Windows 7, and Windows Vista
  • 2. Windows NT, Windows 2000, and Windows XP
  • 3. Linux

After you add the domain information and save the file, your system begins resolving to the specified IP address. After testing is finished, remove these entries.

Windows

Windows 10, Windows 8, Windows 7, and Windows Vista use User Account Control (UAC), so Notepad must be run as Administrator.

For Windows 10 and 8

  • 1. Press the Windows key.
  • 2. Type Notepad in the search field.
  • 3. In the search results, right-click Notepad and select Run as administrator.
  • 4. From Notepad, open the following file: c:\Windows\System32\Drivers\etc\hosts
  • 5. Make the necessary changes to the file.
  • 6. Click File > Save to save your changes.

For Windows 7 and Vista

  • 1. Click Start > All Programs > Accessories.
  • 2. Right-click Notepad and select Run as administrator.
  • 3. Click Continue on the Windows needs your permission UAC window.
  • 4. When Notepad opens, click File > Open.
  • 5. In the File name field, type C:\Windows\System32\Drivers\etc\hosts.
  • 6. Click Open.
  • 7. Make the necessary changes to the file.
  • 8. Click File > Save to save your changes.

Windows NT, Windows 2000, and Windows XP

  • 1. Click Start > All Programs > Accessories > Notepad.
  • 2. Click File > Open.
  • 3. In the File name field, type C:\Windows\System32\Drivers\etc\hosts.
  • 4. Click Open.
  • 5. Make the necessary changes to the file.
  • 6. Click File > Save to save your changes.

Linux

  • 1.Open a terminal window.
    Open the hosts file in a text editor (you can use any text editor) by typing the following line:
  • 2. sudo nano /etc/hosts
  • 3. Enter your domain user password.
  • 4. Make the necessary changes to the file.
  • 5. Press Control-x.
  • 6. When asked if you want to save your changes, answer y.

Kindly check the same and let us know if you have any further concerns.

Was this article helpful?

Related Articles