ruby - windows下用vagrant配置了虚拟环境,windows下ping得通,但是不能在浏览器中打开
淡淡烟草味
淡淡烟草味 2017-04-25 09:02:22
0
2
1032

RT:在windows下用vagrant配置了虚拟环境,windows下ping得通,但是不能在浏览器中打开
我也没做什么配置,就是指定了下ip而已

看帖子有个人说win下的网卡指向的不是vagrant的ipv4,我也改了

进到rails项目当中启动,之后通过links可以看到3000端口可以访问,这里我config数据库密码没改,但是可以看得到3000端口是可以访问到项目的。

但是在本地当中通过ip地址访问的时候,却访问不了,这是什么情况?http://192.168.10.10:3000(ip是我vagrantfile当中设置的)
求解?急,已经配了一天了。。。

补充一下,在win下是ping得通vagrant的


但是vagrant当中如果用这个ip访问却被拒绝只能用127.0.0.1:3000

rails 能监听0.0.0.0:3000,图如下

本地ipconfig当中虚拟机的ip

vagrant虚拟机的ifconfig

淡淡烟草味
淡淡烟草味

reply all(2)
曾经蜡笔没有小新

The host and the virtual machine are not in the same network segment. The host belongs to 192.168.66.0/24 and the virtual machine belongs to 192.168.10.0/24. In this way, the host cannot access the virtual machine.

Modify Vagrantfile and change the IP of the virtual machine to 192.168.66.2

node.vm.network "private_network", ip: "192.168.66.2"

Restart the virtual machine.

vagrant reload

Access on the host: http://192.168.66.2:3000

習慣沉默

It has nothing to do with the Internet.

Rails server is only valid for this machine by default.

If you want to access from other machines, please use

rails server -b 0.0.0.0
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!