How can I set up DD-WRT (or anything else) such that I can have various hostnames all point to various different Nginx projects on the same local server?

I have a wifi router with DD-WRT.

I'm a software engineer developing multiple different sites on my local server (Nginx on Windows 10).

My Windows hosts file specifies various hostnames, and my Nginx config points them to certain directories on my machine, ryandesk.local.

I very often want to access these local websites using an iPhone on my wifi LAN.

The only way I know how to set up my Nginx config, Windows hosts file, and DD-WRT is such that my iPhone can reach one of the local sites.

I can either type in the local IP of my server, or I could visit http://ryandesk.local (since that's the computer name on the network), or I could visit http://ryandesk.xyz (assuming I set up a static lease in DD-WRT as as described in this other answer).

The Nginx config specifies which local site is "default" and will be displayed.

I want all of my local sites to be accessible from my iPhone, though (each with their own hostname).

I'd also prefer answers that don't bother with ports. (It seems like bookmarks and other stuff all stays simpler if I'm not messing with multiple ports.)


According to this page on the DD-WRT wiki, you should be able to point multiple domain names at a single IP address by adding multiple domain names in an address option statement in the "Additional DNSMasq options" box. For example, this DNSMasq option…


…should cause "example.com", "foo.com", and "bar.com" to all resolve to

|improve this answer|||||
  • According to what wiki page (maybe you meant to paste a link)? I found dd-wrt.com/wiki/index.php/DNSMasq_as_DHCP_server but couldn't find what you're talking about. And I tried a configuration based on your example, and it seemed to have no effect. I'm excited about you answer, though, because it looks like it's probably on the right track. Thanks. – Ryan Feb 9 '17 at 21:40
  • Oh I think you meant this page: dd-wrt.com/wiki/index.php/DNSMasq_Local_Network And it worked! The only step that I hadn't taken was switch my iPhone into "Airplane mode" temporarily (to flush the DNS cache) and then switch back onto wifi. It worked. Thanks so much!! – Ryan Feb 9 '17 at 21:43
  • 1
    @Ryan Oops, sorry I forgot to paste in the link before. I've fixed it now. Yes, the second link you found was the one I had meant to link to. Glad you found it and it worked! :-) – Spiff Feb 9 '17 at 21:54
  • 1
    @Ryan note any local DNS you might run can do the same thing. you're just mapping names to IPs -- the DNS looks up the name and returns the associated IP. i believe you could accomplish the same effect in DNSMasq with multiple address definitions that end in the same IP (works in my DDWRT, no guarantees). – quixotic Feb 10 '17 at 0:55
  • 2
    @Ryan also note it might be convenient for your purpose to set a catch-all: address=/web.local/.web.local/ will act as a wildcard -- DNSMasq will give the same IP for any new address that ends in .web.local -- so foo.web.local, bar.web.local, and baz.web.local all get answered without additional setup. – quixotic Feb 10 '17 at 0:57

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.