开发者

Viewing a local web site on the LAN under a different hostname

开发者 https://www.devze.com 2023-02-27 22:49 出处:网络
In short I\'m trying to browse a Mac\'s web site on the local wifi network under a .local hostname that is not the same as the mac开发者_如何学Pythonhine\'s \'computer name\' and think I\'m missing a

In short I'm trying to browse a Mac's web site on the local wifi network under a .local hostname that is not the same as the mac开发者_如何学Pythonhine's 'computer name' and think I'm missing a setup step.

I have a local install of nginx on my Macbook, with the proper /etc/hosts and nginx.conf entries to serve multiple sites, each with their own distinct local hostname. Assume the Macbook's network name is computername.local, and I have 2 sites running, one at http://computername.local and another at http://servicename.local. I can access each of these sites just fine from the local machine, but also want to be able to access http://servicename.local from an iPhone on the same WiFi network. I'm getting a timeout for that URL, but the other one works just fine.

I'm guessing something has to be done to allow servicename.local to be used on the local network, which I've left out. What is required to do that? Do I need to use Bonjour for that? Where would I add this new local hostname?

Another Mac on the same network can access this one under servicename.local just fine if I define the IP in its /etc/hosts file too, but I can't modify that file on the iPhone obviously. It's not jailbroken, and I'm not really interested in doing that just to get this working.


Not sure if it will help the OP, but another way of doing this - besides running a DNS server or jailbreaking the phone - is to run an HTTP proxy on the Mac, and configure the iPhone to use the proxy. Then the iPhone will pick up the Mac's local hosts file entries because it resolves DNS queries through the proxy. I've blogged about how to do this using the free Mac proxy "SquidMan" here: http://egalo.com/99j

0

精彩评论

暂无评论...
验证码 换一张
取 消