ホストマシンのブラウザから仮想マシンにアクセスできません。
node.jsの開発サーバーにアクセスしたいです。
やったこととしては以下です。
#webpack.config.jsに以下を追記 devServer: { contentBase: path.resolve(__dirname, 'public'), port: 3000 } ↓ Vagrantファイルのポートフォワーディング設定のポート番号を書き換えてコメントアウトを外す。 config.vm.network "forwarded_port", guest: 3000, host: 3000 ↓ vagrant halt & up. ↓ npm start ↓ ホストマシンのブラウザからlocalhost:3000でアクセス
下の意味はゲストマシン(127.0.0.1)のポート3000に対してのアクセスを、すべてのIPから(0.0.0.0:*)から受け付けるという風に理解しています。
[vagrant@localhost ~]$ netstat -tanp | grep LISTEN (Not all processes could be identified, non-owned process info will not be shown, you would have to be root to see it all.) tcp 0 0 0.0.0.0:111 0.0.0.0:* LISTEN - tcp 0 0 192.168.122.1:53 0.0.0.0:* LISTEN - tcp 0 0 0.0.0.0:22 0.0.0.0:* LISTEN - tcp 0 0 127.0.0.1:631 0.0.0.0:* LISTEN - tcp 0 0 127.0.0.1:3000 0.0.0.0:* LISTEN 25685/node tcp 0 0 127.0.0.1:25 0.0.0.0:* LISTEN - tcp6 0 0 :::111 :::* LISTEN - tcp6 0 0 :::22 :::* LISTEN - tcp6 0 0 ::1:631 :::* LISTEN -
ゲストのwindows側は以下です。
netstat -an TCP 0.0.0.0:3000 0.0.0.0:0 LISTENING
ファイアーウォールは無効になっています。
telnet localhost 3000
windowsで↑をすると何も表示されなくなります。
よろしくお願いします。
回答1件
あなたの回答
tips
プレビュー
バッドをするには、ログインかつ
こちらの条件を満たす必要があります。