There was a problem loading the comments.

How Do I Change My Hosts File in Plesk

Support Portal  »  Knowledgebase  »  Viewing Article

  Print

Technically, you don't change the hosts file inside Plesk — because the hosts file is a file on your local computer, not on your web server.

But here's what you likely want to do:

 

What Is the hosts File?

The hosts file is a system file on your local computer that maps domain names to IP addresses. It's useful when:

  • You're migrating a website to Plesk and want to test it before DNS is updated

  • You want to preview a domain that’s not live yet


How to Edit the hosts File on Your Computer

For Windows

  1. Click Start, search for Notepad

  2. Right-click and choose Run as Administrator

  3. Open this file:

C:\Windows\System32\drivers\etc\hosts

 

4. Add a line like:

123.123.123.123   yourdomain.com www.yourdomain.com

  1. (Replace 123.123.123.123 with your Plesk server IP)

  2. Save the file. You may need admin rights.


For macOS/Linux

  1. Open Terminal

  2. Run:

sudo nano /etc/hosts

 

3. Add a line like:

 

123.123.123.123   yourdomain.com www.yourdomain.com

 

4. Save (Ctrl+O), then exit (Ctrl+X)

 


How to Get Your Plesk Server IP

To get the IP address of your Plesk server:

  1. Log in to Plesk

  2. Go to Websites & Domains

  3. Click “Hosting & DNS” > “DNS Settings”

  4. Look for the A record IP — that’s your server's public IP


Test Your Site on Plesk Before DNS Changes

After editing the hosts file, open your browser and go to:

http://yourdomain.com

 

Your computer will load the site from Plesk, even if the live domain points somewhere else.

 

To Undo the Change

Just go back and delete or comment out the line you added in the hosts file.


Share via
Did you find this article useful?  

Related Articles


Comments

Add Comment

Replying to  

CAPTCHA

On-Premise Help Desk Software by SupportPal
© Support Portal - WP Lighthost