How to publish local domain names on the local network

domain-name-systeminternal-dnslocal

I'm developing several websites locally, each of them having its own pseudo-domain name, and its Apache VirtualHost:

  • mywebsite.localhost
  • images.mywebsite.localhost
  • anotherwebsite.localhost

I'd like to make these websites available to any computer on my local network, which would allow me to test my website on mobile devices (iOS).

Is there a way to "publish" a name such as mywebsite.localhost or mywebsite.local to my local network, so that these names would resolve to my computer's IP address for any computer on the network?

I don't think I can configure my ISP's router in any way to act as a DNS server.

While researching, I read about mDNS and Bonjour, but can't find if they are what I'm looking for, and even less how to make that work.

Any help appreciated!

Best Answer

.localhost is a reserved TLD so you'll want to change that so you don't run into issues.

One way to do this would be to run a DNS server or forwarder, such as dnsmasq, make sure all clients are using it and the propagate the zones with the mappings you're after. This adds quite a bit of overhead and can be problematic if it's not configured correctly.

Assuming you can control the applications domain names, a quick and easy option is xip.io with no configuration required.

e.g. your server is 192.168.0.23 point a client on the same network subnet to http://192.168.0.23.xip.io/ and it should work.