【问题标题】:Ghost - Can't connect to the bootstrap socket (localhost 8000) ECONNREFUSEDGhost - 无法连接到引导套接字 (localhost 8000) ECONNREFUSED
【发布时间】:2019-10-03 14:25:15
【问题描述】:

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

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

我的 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

【问题讨论】:

  • @CommonSenceCode 您使用的是什么版本的 Node?如果你使用的是旧版本的 Node,更新,然后 ghost update --force
  • @tim 感谢您尝试我从节点 8 更新到最新的稳定节点 10.16.3,但我仍然遇到相同的错误 Can't connect to the bootstrap socket (localhost 8000)

标签: node.js linux ghost-blog


【解决方案1】:

更新

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

更新2及解决方案:

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

【讨论】:

    【解决方案2】:

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

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

    我认为我是通过安装配置 SSL 证书的 Certbot 引起的。然后当我安装Ghost时,也安装了acme.sh。我认为双重 SSL 解决方案的影响比显而易见的要大。

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

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

    【讨论】:

    • 虽然此链接可能会回答问题,但最好在此处包含答案的基本部分并提供链接以供参考。如果链接页面发生更改,仅链接答案可能会失效。 - From Review
    【解决方案3】:

    请运行

    sudo netstat -lnp | grep 8000
    

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

    【讨论】:

    • 那个命令没有打印任何东西。无论如何,我尝试了 sudo ps aux | grep 8000 并得到 ghost-m+ 32461 0.0 0.1 14856 1148 pts/0whenn 我尝试杀死它:sudo kill -9 32461 我得到“没有这样的过程”
    【解决方案4】:

    config.production.json 中删除bootstrap-socket 并重新启动,很可能端口 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"
      }
    }
    

    希望对您有所帮助!

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2017-07-15
      • 1970-01-01
      • 2011-08-11
      • 2020-06-26
      • 2016-08-13
      • 1970-01-01
      • 2020-04-09
      相关资源
      最近更新 更多