I recently installed vagrant in windows 10 and everything just work fine but as I know almost nothing about Virtualization or VM's I got a problem when connecting to a server.
我最近在Windows10上安装了流浪者,一切都很好,但由于我对虚拟化或VM几乎一无所知,所以在连接到服务器时遇到了问题。
I have a nodejs server running in a vagrant box and of course a address or "local host" but can't connect to it through my main OS, just the typical "Problem Loading Page" or can’t establish a connection to the server at localhost:8000.
我有一个NodeJS服务器在一个流浪箱中运行,当然还有一个地址或“本地主机”,但不能通过我的主操作系统连接到它,只是典型的“加载页面问题”或无法建立到本地主机:8000的服务器的连接。
I'm using ssh instead of winssh, idk if it's useful.
如果有用的话,我正在使用ssh而不是winssh,idk。
I assume is a problem with the localhost, which of course are different between vagrant and windows.
我认为是本地主机的问题,这在流浪者和Windows之间当然是不同的。
The docs didn't where helpful.
医生没有帮助。
更多回答
Just configure the network adapter of your VM and use a proper IP address. Ask for more advice at superuser.com.
只需配置您的VM的网络适配器并使用正确的IP地址。如需更多建议,请访问Superuser.com。
优秀答案推荐
Because it seems like you may be new to Vagrant the quickest and easiest way for you to access your VM via localhost is to set up port forwarding in your Vagrantfile.
因为您可能不熟悉Vagant,所以通过本地主机访问您的VM的最快、最简单的方法是在您的Vagrantfile中设置端口转发。
Vagrant.configure("2") do |config|
config.vm.network "forwarded_port", guest: 80, host: 8080
end
Using the example above you’ve forwarded your host port, 8080, to your vm’s port 80. So when you go to localhost:8080 it will return whatever is listening on port 80 of your VM. Just make sure that if you have a firewall setup in your VM you open port 80.
使用上面的示例,您已经将主机端口8080转发到了您的VM的端口80。因此,当您转到localhost:8080时,它将返回在您的VM的端口80上侦听的任何内容。只要确保在您的VM中设置了防火墙,您就可以打开端口80。
更多回答
我是一名优秀的程序员,十分优秀!