localhost is always the computer making the request, that is, the computer hosting the browser.
Typically an internal server is connected to the internet via a router. The router has an external addressed assigned by the isp (often via dynamic dhcp). The router does nat translation (maps internal to external) to access the internal server from the internet, you configure the router nat translate the external to a single internal.
Typically there is also a firewall with incoming, and outgoing rules on which ports are open.