我在相当长的一段时间内(大概2周)第一次重启了我的iMac。当我尝试通过homestead up重启我的homestead机器时,我得到了这个错误:
Vagrant cannot forward the specified ports on this VM, since they
would collide with some other application that is already listening
on these ports. The forwarded port to 80 is already in use
on the host machine.
To fix this, modify your current projects Vagrantfile to use another
port. Example, where '1234' would be replaced by a unique host port:
config.vm.network :forwarded_port, guest: 8000, host: 1234
Sometimes, Vagrant will attempt to auto-correct this for you. In this
case, Vagrant was unable to. This is usually because the guest machine
is in a state which doesn't allow modifying port forwarding.我没有其他的虚拟盒子在运行。我运行了sudo lsof -i :80,得到了以下列表:
COMMAND PID USER FD TYPE DEVICE SIZE/OFF NODE NAME
Google 391 jamesspence 85u IPv4 0xe9a8a2357c33587 0t0 TCP 192.168.1.84:49665->ord08s12-in-f28.1e100.net:http (ESTABLISHED)
Google 391 jamesspence 86u IPv4 0xe9a8a235682a727 0t0 TCP 192.168.1.84:49666->ord31s22-in-f6.1e100.net:http (ESTABLISHED)
Google 391 jamesspence 249u IPv4 0xe9a8a234f7d0247 0t0 TCP 192.168.1.84:49215->ec2-54-82-95-91.compute-1.amazonaws.com:http (ESTABLISHED)
httpd 1240 root 5u IPv6 0xe9a8a234f7e08a7 0t0 TCP *:http (LISTEN)
httpd 1241 _www 5u IPv6 0xe9a8a234f7e08a7 0t0 TCP *:http (LISTEN)"Google“进程似乎是Chrome,因为杀死它就会杀死我的浏览器。Apache2似乎也在此端口上运行。因此,用sudo apachectl stop阻止它似乎是有帮助的。当我这样做的时候,我通过了端口冲突阶段。然而,然后我的虚拟盒子在形成连接时挂起:
default: Warning: Connection timeout. Retrying...
default: Warning: Connection timeout. Retrying...我已经无计可施了。不到24小时前,我的流浪汉机器运行得很好,没有任何问题。我不知道从哪里开始。有人知道我下一步该做什么吗?
发布于 2015-06-02 23:01:21
我最终通过在安全启动模式下启动(在初始启动时按住Shift键)来修复它,然后重新启动。在那之后,我仍然得到了connection timeout的问题,但只是手动启动和停止virtualbox解决了这个问题,现在一切都很好。
发布于 2015-06-02 23:06:52
你的第一条消息的意思是你的端口转发是无效的,因为它使用了你主机上的80端口(所以你的Mac),这个端口的使用方式就像你通过Chrome和其他方式识别它一样。您应该尝试在您的Vagrantfile中放入一个正确的转发,如下所示:
config.vm.network "forwarded_port", guest: 80, host: 8080 #http-apache然后使用localhost:8080而不是默认的localhost:80 (与localhost相同)访问您的虚拟机。
希望这能有所帮助。
https://stackoverflow.com/questions/30599404
复制相似问题