Hapi:移动到 vps 后端口关闭

Hapi: Port is closed after moving to vps

我将我的 Hapi 应用程序从我的本地计算机移动到 vps,然后它突然停止工作,我检查了一下,我看到尽管 Hapi 正在记录该信息服务器 运行 位于:http://localhost:8080 居然关门了

我很确定这是 Hapi 的问题,因为其他端口正在工作,我没有任何防火墙规则,甚至在我在本地端口扫描我的服务器时它甚至关闭了。

这是我的 Hapi 配置:

  const hapiServer = new Hapi.Server({
  cache: {
    engine: require('catbox-redis'),
    host: redisAddress,
    port: redisPort
  }
});

hapiServer.connection({
    host: 127.0.0.1,
    port: 8080
});

hapiServer.register({
  register: yar,
  options: yarOptions
}, function (err) {

  // start your hapiServer after plugin registration
  hapiServer.start(function (err) {
    console.log('info', 'Server running at: ' + hapiServer.info.uri);
  });
});

我什至将主机更改为我的真实 IP 地址并将端口更改为 3000,但它没有用。

你发现这里有什么错误了吗

hapiServer.register({
  register: yar,
  options: yarOptions
}, function (err) {
  // start your hapiServer after plugin registration
  hapiServer.start(function (err) {
    if(err) {
      console.log('registration failed', err) // ???
      return;
    }
    console.log('info', 'Server running at: ' + hapiServer.info.uri);
  });
});