Windows 上的端口转发流浪者 [英] Port forwarding vagrant on windows

查看:67
本文介绍了Windows 上的端口转发流浪者的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在 Windows 7 上.我有一个 vagrantfile 指定为乘客转发端口,在 vagrant up 上它声称它已经转发了端口,但事实并非如此,当我启动我的应用程序时,我可以运行

I am on windows 7. I have a vagrantfile specified to forward ports for passenger, on vagrant up it claims that it has forwarded the ports, however this is not the case, when I start my application I can run

卷曲 0.0.0.0:3000

curl 0.0.0.0:3000

并从我的 rails 应用程序中获取结果,但是在 vagrant 之外我无法连接到服务器.如何从 vagrant 外部访问端口?

and get a result from my rails application, however outside vagrant I cannot connect to the server. How can I access the port from outside vagrant?

Vagrantfile 包含以下几行

The Vagrantfile contains the following lines

config.vm.network :forwarded_port, 来宾: 3306, 主机: 3306 # MySQL

config.vm.network :forwarded_port, guest: 3306, host: 3306 # MySQL

config.vm.network :forwarded_port, guest: 3000, host: 3000 #passenger

config.vm.network :forwarded_port, guest: 3000, host: 3000 # Passenger

推荐答案

一种可能是端口冲突正在发生,例如.某些东西正在主机的端口 3000 上运行.根据端口转发文档

One possibility is that port collision is occurring, eg. something is running on port 3000 of your host machine. According to the Port Forwarding documentation

您可以添加 auto_correct: true 标志,当您 vagrant upvagrant reload 时,该标志将输出任何冲突和自动更正详细信息.

you can add the auto_correct: true flag which will output any collision and autocorrect details when you vagrant up or vagrant reload.

这篇关于Windows 上的端口转发流浪者的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆