Applicable to:
- Plesk for Linux
- Plesk for Windows
Question
How to access a website which exists in Plesk, but is not resolved to it from the Internet? For example, when a website was created for tests, recently migrated or its DNS zone has not propagated through the Internet yet.
Answer
-
Go to Websites & Domains > example.com.
-
Click Preview under the domain.
Note: Preview feature requires nginx reverse proxy. Otherwise, the Preview button will be unavailable.
Modifying the 'hosts' file allows overriding DNS for a domain on a particular machine and causes local machine to look directly at the IP address specified.
For example, the domain example.com is hosted on a server with IP address 203.0.113.2, but is not resolved to this IP from the Internet. To make your PC/Mac resolve this website to this particular IP address, add the line below to your local 'hosts' file:
CONFIG_TEXT: 203.0.113.2 example.com www.example.com
Modifying the 'hosts' file...
-
on Windows OS
-
Run the following command to open the 'hosts' file in Windows Notepad:
C:\> notepad C:\Windows\System32\Drivers\etc\hosts
-
Add domain's IP address and a domain name on a new line.
-
Click File > Save to save your changes.
-
on macOS
-
Open Applications > Utilities > Terminal.
-
Open the
hosts
file by typing the following line in a terminal window:# sudo nano /private/etc/hosts
Type your domain user password when prompted.
-
Add domain's IP address and a domain name on a new line.
Note: The file contains some comments (lines starting with a hash "#" symbol) and some default hostname mappings (for example, 127.0.0.1 – local host). Add your new mappings after the default mappings.
-
Save the hosts file by pressing 'Control+x' and answering
y
. -
Make changes take effect by flushing the DNS cache with the following command:
# dscacheutil -flushcache
-
-
on Linux OS
-
In Linux terminal, open the 'hosts' file in a text editor:
# vi /etc/hosts
-
Add domain's IP address and a domain name on a new line.
-
Save the changes and close the file.
-
-
Go to Tools & Settings > IP Addresses > click on a public IP address, to which the required domain is assigned in Plesk > select an offline website as a Default site from the drop-down menu.
-
Now, to access the domain, type in the public IP address chosen above in a web-browser: http://203.0.112.2:80.
Note: example.com should be assigned to this IP address in Plesk at Domains > example.com > Hosting Settings. Otherwise, it will not appear in the list.
Comments
10 comments
Hi,
I don't know why but the website is offline with no reason. It was working before.
I checked the IP address page and it's working, it's showing default Plesk page.
I tried to login FTP via same IP address and it's working.
Preview page of the IP address is working. It's showing the website.
DNS addresses are correct.
But;
E-mail is not working
Website is not loading
No connect at all. It was all working a few days ago.
What should I do at this situation?
Thanks in advance.
@Usta, The fact that the website shows the default page is a general error. Please open a support ticket with us so we can investigate thoroughly: https://support.plesk.com/hc/en-us/articles/213608509-How-to-submit-a-request-to-Plesk-support-
When I do this it takes me to the location that the standard dns server points to rendering my hosts file useless
@Baruch Fishman it is the option when the site is not propagated yet
This issue was resolved. As it turns out, my isp was doing some kind of intercept on the host header.
Baruch Fishman
Thank you for letting us know.
I can see my website through the preview. When I type in my browser, it doesn't work, even after editing /etc/hosts file on my machine.
DNS records are also already done
Hello Mario Fadegnon,
The issue can have several causes. Please open a support ticket with us so we can investigate thoroughly.
@Mario, could you solve your problem? How?
We have the same issues. After making a migration with Plesk Migrator, and after editing /etc/hosts (MacBook Air), it works for one domain but not for the other 5 domains...
If it doesn't work right away, the DNS response might still be cached in the browser.
In Firefox, you can clear the cache by entering about:networking#dns in the url bar (without http!) and clicking the button there if the cached items in the list below are not what they are supposed to be.
Please sign in to leave a comment.