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

Ghost - Can't connect to the bootstrap socket (localhost 8000) ECONNREFUSED

我已经尝试了很长时间来调试我的幽灵博客,如您所见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

更新

回答

此处:

请运行

sudo netstat -lnp | grep 8000

并查看端口 8000 是否已被使用。如果是,则更改 ghost 配置上的端口或禁用正在使用该端口的进程。

更新

config.production.json 中删除 bootstrap-socket 解决了这个问题,但我在访问我的网站时仍然 502 Bad Gateway nginx/1.14.0 (Ubuntu)

更新2及解决方案:

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

从您的 config.production.json 中删除 bootstrap-socket 并重新启动,很可能端口 8000 已被使用或 bootstap 无法在那里建立连接。 本质上反映在你的 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"
  }
}

希望对您有所帮助!

这是我在这里的第一个“答案”。我 运行 在新安装过程中遇到了这个问题,并且没有任何松动。为了修复错误,我在 mysql 的末尾使用通配符 * 清除了 Mysql-server 和 Node.js(apt purge,作为 root)。我还删除了 /etc 和 /usr/share 中 Mysql 的所有关联文件夹。至于Nodejs的相关文件夹,我只是从/etc.

中删除了那些

我也卸载了Ghost。创建一个新的站点目录并重新安装 Node.js、Mysql、& Ghost。我让 Ghost 负责 SSL。我选择在设置结束时启动 Ghost vs 运行(调试)。它正在运行!

我想是我安装了配置了 SSL 证书的 Certbot 导致了这个问题。然后我安装Ghost的时候,acme.sh也安装了。我认为双 SSL 解决方案的影响比显而易见的要大。

我 运行 从 Google 那里得到的解决方案有效。搜索“卸载或完全删除 mysql ubuntu 16.04”(即使我是 运行ning 20.04)来自 linuxscriptshub 的说明我认为放置通配符有很大帮助。

至于删除所有目录,那是我的想法,因为删除所有配置和支持文件似乎很有意义。