系统版本:OS X 10.10.5
使用 Homebrew 安装的 Nginx
路径在 /usr/local/Cellar/nginx/1.8.0/bin/nginx
启动 Nginx
sudo nginx
本地访问以下网址均正常
http://127.0.0.1:8080
http://192.168.1.2:8080
同一网段的手机却无法访问。
将 /usr/local/Cellar/nginx/1.8.0/bin/nginx 添加到 防火墙
设置为:Allow incoming connections,还是无法访问。
打开系统设置,关闭防火墙,手机成功访问网页,由此确定是防火墙的原因。
搜索相关资料,尝试后无果:
https://www.v2ex.com/t/131749
http://ju.outofmemory.cn/entry/154709
http://apple.stackexchange.com/questions/188160/open-firewall-to-run-nginx
http://superuser.com/questions/519289/mac-firewall-blocking-nginx-port-80-from-external-side
现在只想到两个解决办法:
1. 关闭防火墙(下下策)
2. 用其他方法转发到 Nginx
有人遇到过这个问题吗?