[英]Can’t access rails app on Mac host from VMware Fusion Guest
I'm probably doing something stupid here, but.... 我可能在这里做些蠢事,但是....
I can't access a rails app running on my Mac from a Windows 10 VM. 我无法从Windows 10 VM访问在Mac上运行的Rails应用程序。 I have set the network adapter to "Share with My Mac". 我已将网络适配器设置为“与我的Mac共享”。 I can access a PHP site running on my mac via http://[my-machine-name].local or http://[my-ip-address] . 我可以通过http:// [my-machine-name] .local或http:// [my-ip-address]访问Mac上运行的PHP站点。 But if I specify port 3000 to view my rails app I get an error message (to the effect that [my-ip-address] refused to connect) even though the app is running. 但是,如果我指定端口3000查看我的Rails应用程序,即使该应用程序正在运行,我也会收到一条错误消息(表示[my-ip-address]拒绝连接)。 I don't know if this is an issue at the Mac end (though my firewall is off for testing), the windows end, or to do with my VMWare network adapter setting. 我不知道这是Mac端(尽管我的防火墙已关闭以进行测试),Windows端还是与我的VMWare网络适配器设置有关的问题。 Any assistance gratefully received 感谢收到的任何协助
Peter 彼得
只需在运行Rails应用程序(例如rails server -b 0.0.0.0:3000
时使用-b
标志,即可将其绑定到整个网络接口,并且可以从外部进行访问
I encountered this problem just now. 我刚才遇到了这个问题。 I could not get it to work with -b 0.0.0.0. 我无法使其与-b 0.0.0.0一起使用。
I set it to my hosts local ip "rails server -b 192.168.1.10". 我将其设置为我的主机本地IP“ rails server -b 192.168.1.10”。 I was then able to access the host through my VM's browser http://192.168.1.10:3000/ . 然后,我可以通过VM的浏览器http://192.168.1.10:3000/访问主机。 My VM network is set to NAT. 我的VM网络设置为NAT。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.