Strongloop 仅绑定到 127.0.0.1

Strongloop only binds to 127.0.0.1

这个问题与这个问题类似 - Node.js connect only works on localhost - 除了据我所知,Strongloop 中唯一可用的配置是 config.json。

我尝试在 config.json 主机值中使用“0.0.0.0”,如下所示,但 netstat 仍然显示它仅绑定到 127.0.0.1

{
  "host": "0.0.0.0",
  "restApiRoot": "/api",
  "host": "0.0.0.0",
  "port": 3000,
  "remoting": {
    "context": {
      "enableHttpContext": false
    },
...
...

这是netstat的日志:

tcp        0      0 127.0.0.1:27017         0.0.0.0:*               LISTEN
tcp        0      0 0.0.0.0:111             0.0.0.0:*               LISTEN
tcp        0      0 0.0.0.0:51733           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:3000          0.0.0.0:*               LISTEN

这是我的网络配置:

vagrant@precise64:~/projects/loopback-example-offline-sync/server$ ifconfig -a
eth0      Link encap:Ethernet  HWaddr 08:00:27:88:0c:a6
          inet addr:10.0.2.15  Bcast:10.0.2.255  Mask:255.255.255.0
          inet6 addr: fe80::a00:27ff:fe88:ca6/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:7428 errors:0 dropped:0 overruns:0 frame:0
          TX packets:7205 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:4740627 (4.7 MB)  TX bytes:3865969 (3.8 MB)

eth1      Link encap:Ethernet  HWaddr 08:00:27:bf:af:6b
          inet addr:33.33.33.10  Bcast:33.33.33.255  Mask:255.255.255.0
          inet6 addr: fe80::a00:27ff:febf:af6b/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:1325 errors:0 dropped:0 overruns:0 frame:0
          TX packets:1565 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:101155 (101.1 KB)  TX bytes:238095 (238.0 KB)

lo        Link encap:Local Loopback
          inet addr:127.0.0.1  Mask:255.0.0.0
          inet6 addr: ::1/128 Scope:Host
          UP LOOPBACK RUNNING  MTU:16436  Metric:1
          RX packets:909 errors:0 dropped:0 overruns:0 frame:0
          TX packets:909 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0
          RX bytes:3429927 (3.4 MB)  TX bytes:3429927 (3.4 MB)

我可以使用 33.33.33.10 通过 SSH 连接到 vagrant box。用 33.33.33.10 替换 0.0.0.0 也没有用。我尝试从配置中完全删除主机属性,但也没有用。 UFW 已禁用。

我没有其他选择可以尝试,因此在 SO 上发帖 :-)

好的。我想到了。该配置实际上是从 Gruntfile.js 驱动的。太混乱了。定义host的地方太多了