Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

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!

share|improve this question

2 Answers 2

up vote 4 down vote accepted

.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.

share|improve this answer
    
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
    
Thanks for all the useful info! –  Benjamin Mar 27 '13 at 9:45

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.

share|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

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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