2015-06-02 233 views
0

我在相當長的一段時間(例如2周)第一次重新啓動了iMac。當我試圖通過homestead up重新啓動我的家園中,我得到這個錯誤:端口80上的端口碰撞

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) 

「谷歌」的過程似乎是瀏覽器,因爲它殺死殺死我的瀏覽器。 Apache2也似乎在這個端口上運行。所以,暫停sudo apachectl stop似乎有所幫助。當我這樣做的時候,我經過了港口碰撞階段。然而,然後我的虛擬箱掛起形成一個連接:

default: Warning: Connection timeout. Retrying... 
default: Warning: Connection timeout. Retrying... 

我在我的智慧結束在這裏。不到24小時前,我的流浪者箱子運行得很好,沒有問題。我不知道該從哪裏開始。有人知道我下一步該做什麼嗎?

回答

0

我最終通過安全引導啓動(初始啓動時按住Shift鍵)來修復它,然後重新啓動。之後,我仍然遇到了connection timeout問題,但只是手動啓動和停止virtualbox來修復問題,現在一切正常。

0

你的第一條消息意味着你的端口轉發無效,因爲它在你的主機上使用了80端口(所以你的Mac),而且這個端口就像Chrome和其他人一樣使用它。你應該嘗試是把你的Vagrantfile正確轉發,就像這樣:

config.vm.network "forwarded_port", guest: 80, host: 8080 #http-apache 

,然後使用localhost:8080訪問你的虛擬機,而不是默認的localhost:80(這是一樣的localhost)。

希望這會有所幫助。

+0

但問題是,它正在到達該訪客端口,試圖轉發它並拋出錯誤。更改主機端口並不能解決任何問題。 –

+0

你能分享你的Vagrantfile嗎?我相信答案就在那裏,因爲你的解決方案看起來有點冒險,而不是真正的解決方案。 –

+0

我正在使用[Laravel Homestead](http://laravel.com/docs/5.0/homestead),它具有我未觸及的預配置VagrantFile。 –