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!


.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 point a client on the same network subnet to and it should work.

| improve this answer | |
  • 1
    oh wow, xip.io is genius :D – hub Mar 26 '13 at 10:08
  • Indeed, xip.io is the best option so far. I was still hoping that there was a way to publish some kind of arbitrary .local name that all computers on the network would magically resolve! – Benjamin Mar 26 '13 at 20:03
  • I know your pain! I have this handled by my router, it runs a DNS Forwarder so all clients have internal DNS assigned by DHCP. If a zone isn't found it forwards the query off to the ISP DNS. When the DHCP lease is assigned it also registers each client's host name in the local DNS e.g. host.myintdomain.tld. net result is it works as you'd like, however there is potential to break every client's name resolution and bring your network to it's knees if it's misconfigured. FWIW I use pfsense it's free and powerful! – rjocoleman Mar 26 '13 at 20:15

You set up a DNS server and point your clients at it. The DNS server doesn't have to be your ISPs router. Your DNS server should answer all queries for which it is authoritative, and then forward all other requests to the router, preferably caching a few entries along the way.

Either that or figure out a way to distribute hosts file entries, but that's a huge pain to manage.

| improve this answer | |
  • That requires a configuration on every client, which alone is a big downside! – Benjamin Mar 26 '13 at 20:01
  • @Benjamin - Is your DHCP server not handing out DNS server addresses? – EEAA Mar 26 '13 at 20:41

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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