I've an Nginx web server running on address. Also, I've pointed my domain to this server. This server has public IP NAT-d through the corporate network. I can access my website fine from an outside network using the domain name. However, I cannot access this website from the server itself or over LAN network (from server)

For example, curl mydomain.example doesn't respond from the server itself or from secondary server

I can actually put this server's internal IP address inside both server's /etc/hosts and curl works fine. But I want to solve root cause if possible, anyone faced similar situations? What could be causing this issue?

  • Thank you @HBruijn , looks like this is the answer. Also thanks for the grammar edit guys! Aug 17, 2019 at 2:51

1 Answer 1


The problem is you are trying to access resource from inside lan by using a public address. Most routers get confused with that.

There are several solutions (that i used, there might be more):

  1. Putting local ip address in your hosts file
  2. Using split DNS (if you have internal and external dns, it might be something to look at)
  3. Using settings on your router to set routing rules so your router can redirect requests to your internal server.

Which one you use will mostly depend on your network setup and available hardware. Hosts file is the simplest, but if it's a laptop you use outside the network as well, you'll have to enable/disable the rule depending on where you are. Second option is only good if you already have an internal/external dns setup, and third will depend on your router capabilities. It's the one i use atm(My router is a Mikrotik). There are probably more solutions out there, so you can look to other responses or google.

  • Thanks for the answer. Looks like this is the direct answer to the question. Aug 17, 2019 at 2:54

Not the answer you're looking for? Browse other questions tagged or ask your own question.