Ghost-无法连接到引导套接字(localhost 8000)ECONNREFUSED

时间:2019-10-03 14:25:15

标签: node.js linux ghost-blog

很久以来,我一直在尝试调试我的幽灵博客,如您所见here

我已经取得了一些进展,该问题似乎与ghost的bootstrap套接字上的错误有关。

我在Digital Ocean服务器中的config.production.json是:

{
  "url": "https://www.mifitnessfacil.com",
  "server": {
    "port": 2369,
    "host": "127.0.0.1"
  },
  "database": {
    "client": "mysql",
    "connection": {
      "host": "localhost",
      "user": "root",
      "password": "foobar",
      "database": "foobar"
    }
  },
  "mail": {
    "transport": "Direct"
  },
  "logging": {
    "transports": [
      "file",
      "stdout"
    ]
  },
  "process": "systemd",
  "paths": {
    "contentPath": "/var/www/ghost/content"
  },
  "bootstrap-socket": {
    "port": 8000,
    "host": "localhost"
  }
}

运行ghost run时,我得到:

[2019-10-03 14:24:00] INFO Ghost is running in production...
[2019-10-03 14:24:00] INFO Your site is now available on https://www.mifitnessfacil.com/
[2019-10-03 14:24:01] INFO Ctrl+C to shut down
[2019-10-03 14:24:01] WARN Can't connect to the bootstrap socket (localhost 8000) ECONNREFUSED
[2019-10-03 14:24:01] WARN Tries: 0
[2019-10-03 14:24:01] WARN Retrying...
[2019-10-03 14:24:01] WARN Can't connect to the bootstrap socket (localhost 8000) ECONNREFUSED
[2019-10-03 14:24:01] WARN Tries: 1
[2019-10-03 14:24:01] WARN Retrying...
[2019-10-03 14:24:01] WARN Can't connect to the bootstrap socket (localhost 8000) ECONNREFUSED
[2019-10-03 14:24:01] WARN Tries: 2
[2019-10-03 14:24:01] WARN Retrying...
[2019-10-03 14:24:01] WARN Can't connect to the bootstrap socket (localhost 8000) ECONNREFUSED
[2019-10-03 14:24:01] INFO Ghost boot 3.299s

更新

  • 它在Ubuntu 18.04.3 LTS上运行
  • 节点版本10.16.3
  • Npm版本6.9.0

答案

此处:https://stackoverflow.com/a/58274370/4031815

3 个答案:

答案 0 :(得分:0)

请运行

sudo netstat -lnp | grep 8000

,然后查看端口8000是否已在使用中。如果是这样,请在ghost配置上更改端口,或禁用正在使用该端口的进程。

答案 1 :(得分:0)

更新

bootstrap-socket中删除config.production.json可以解决该问题,但是访问我的网站时我仍然得到502 Bad Gateway nginx/1.14.0 (Ubuntu)

更新2和解决方案:

https://github.com/TryGhost/Ghost-CLI/issues/1017

答案 2 :(得分:0)

bootstrap-socket中删除config.production.json并重新启动,很可能端口8000已被使用,或者引导程序无法在该处建立连接。 本质上在您的config.production.json中反映出这一点:

{
  "url": "https://www.mifitnessfacil.com",
  "server": {
    "port": 2369,
    "host": "127.0.0.1"
  },
  "database": {
    "client": "mysql",
    "connection": {
      "host": "localhost",
      "user": "root",
      "password": "foobar",
      "database": "foobar"
    }
  },
  "mail": {
    "transport": "Direct"
  },
  "logging": {
    "transports": [
      "file",
      "stdout"
    ]
  },
  "process": "systemd",
  "paths": {
    "contentPath": "/var/www/ghost/content"
  }
}

希望这会有所帮助!