我在很长一段时间内第一次重启我的iMac(类似于2周)。当我试图通过homestead up
重启我的宅基地时,我收到了这个错误:
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小时前,我的流浪盒运行得很好,没问题。我不知道从哪里开始。有没有人知道我接下来该做什么?
答案 0 :(得分:0)
我最后通过在安全启动时启动(在最初启动时按住Shift)修复它,然后重新启动。在那之后,我仍然遇到connection timeout
问题,但只是手动启动和停止虚拟机,现在一切正常。
答案 1 :(得分:0)
您的第一条消息意味着您的端口转发无效,因为它使用了主机上的80端口(因此您的Mac),并且此端口的使用方式与您在Chrome上识别它一样。您应该尝试的是在Vagrantfile中输入正确的转发信息,如下所示:
config.vm.network "forwarded_port", guest: 80, host: 8080 #http-apache
然后使用localhost:8080
访问您的虚拟机,而不是默认localhost:80
(与localhost
相同)。
希望这有帮助。