2015-04-21 25 views
0

我在設置運行CentOS7的流浪者後連接到mean.io服務器時遇到問題。我有端口轉發和禁用/打開防火牆,但仍無法對wget或curl -v做出響應。無法連接到Vagrant中的mean.io

我有自動去我現在身在何處以下步驟:

git clone [email protected]:Scrier/Vagrant.git 
cd Vagrant/mean 
vagrant up 

在這裏,我得到的輸出端口轉發設置:

==> default: Attempting graceful shutdown of VM... 
==> default: Clearing any previously set forwarded ports... 
==> default: Couldn't find Cheffile at ./Cheffile. 
==> default: Clearing any previously set network interfaces... 
==> default: Preparing network interfaces based on configuration... 
    default: Adapter 1: nat 
==> default: Forwarding ports... 
    default: 3000 => 3000 (adapter 1) 
    default: 35729 => 35729 (adapter 1) 
    default: 80 => 8888 (adapter 1) 
    default: 22 => 2222 (adapter 1) 
... 

下一步是流浪裏面:

vagrant ssh 
cd /vagrant 
sudo ./install.sh 
sudo npm install -g gulp 
sudo npm install -g bower 
sudo npm install -g mean-cli 

最後3個命令有時不起作用,在後面的步驟中抱怨某些npm:s擁有b根。不知道是什麼觸發了這一點。

接下來,我創建一個測試項目/遊民

mean init test 

然後我試着爲要麼一口(CD測試& & NPM安裝& &一整套)或服務器(節點服務器)

運行默認的應用程序啓動很好,並開始在端口3000上聽。我可以捲曲流浪漢,並在服務器應答時在本地主機上執行wget。

curl 'http://localhost:3000' 
wget 'http://localhost:3000' 

從外面流浪者這樣做給人一種鎖,現在3天之後搜索我不能在網絡上找到更多的幫助。

curl -v 'http://localhost:3000' 
wget 'http://localhost:3000' 

給這個輸出:

Andreass-MBP:~ andreasjoelsson$ wget 'http://localhost:3000' 
--2015-04-21 20:50:30-- http://localhost:3000/ 
Resolving localhost... 127.0.0.1, ::1, fe80::1 
Connecting to localhost|127.0.0.1|:3000... connected. 
HTTP request sent, awaiting response... ^C 

Andreass-MBP:~ andreasjoelsson$ curl -v 'http://localhost:3000' 
* Rebuilt URL to: http://localhost:3000/ 
* Hostname was NOT found in DNS cache 
* Trying 127.0.0.1... 
* Connected to localhost (127.0.0.1) port 3000 (#0) 
> GET/HTTP/1.1 
> User-Agent: curl/7.37.1 
> Host: localhost:3000 
> Accept: */* 
> 
^C 

都停止在響應。

我已閱讀關於設置IP 0.0.0.0而不是本地主機運行nodejs類似的問題,但我不能找到任何配置的意思。

回答

1

所以,很長一段時間敲我的頭這之後,我得到了它在這個線程試圖建議工作:Empty reply from server - can't connect to vagrant vm w/port forwarding

通過在/ etc/hosts中改變爲127.0.0.1的localhost 0.0.0.0它開始工作。似乎有點奇怪,我必須去攻擊/ etc/hosts而不是使用mean.io中的設置,但是我得到了它的工作,所以我會默默無聞地感到高興。

以下是使其工作的快速命令。

sed -i -E "s/127.0.0.1(.*)/0.0.0.0\1 # Replaced 127.0.0.1 to work with Vagrant external access./" /etc/hosts 

可能需要以root身份運行它。