Ashkan Mobayen Khiabani
Ashkan Mobayen Khiabani

Reputation: 34160

Website works remotely but not on the server itself when called by domain

I am using Windows Server 2019 and in IIS 10 I have created a website and I have bound it to both: "localhost" and "mydomain.com" on port 80.

mydomain.com works correctly from any client but on the server only when I call "localhost" it works otherwise I get the following error (when called by domain):

enter image description here

Upvotes: 2

Views: 1456

Answers (2)

Etienne Dijon
Etienne Dijon

Reputation: 1303

On clients, your request domain.com is resolved by its configured DNS. It can be on public DNS (internet) or private ones (company, intranet).

From the server domain.com, do you have access to the same DNS than your clients use ?

If not, either configure additional DNS servers : https://serverspace.io/support/help/configuring-a-dns-server-on-windows-server-2012-or-later/

or you could edit you Host file of mydomain.com (local DNS): C:\Windows\System32\drivers\etc\hosts

It may look like that :

127.0.0.1   localhost
127.0.1.1   mydomain.com

# and existing settings

Upvotes: 2

Shogun Nassar
Shogun Nassar

Reputation: 633

Configure your DNS in your local server to resolve the domain name as localhost

Upvotes: 3

Related Questions