【问题标题】:What is the cause of the "502 Bad Gateway" after Ghost 1.8.7 updateGhost 1.8.7更新后出现“502 Bad Gateway”是什么原因
【发布时间】:2017-09-20 00:49:52
【问题描述】:

我最近在我的 AWS ec2 Ubuntu 16.04 服务器上安装了 Ghost 1.8.4 和 Nginx。当我加载我的博客站点时,它正确地将我带到了 Ghost 主页,我从那里登录到 Ghost 管理员。在管理屏幕上,有一条消息要更新。

我在腻子中运行ghost update

更新似乎是成功的,但是当我返回我的博客站点时,我收到了以下错误:

502 错误网关 nginx/1.10.3 (Ubuntu)

  1. 有谁知道这个错误的可能原因以及如何解决?
  2. 我查看了一些帖子,这些帖子表明我应该在更新之前关闭 Ghost。如果这是真的,我的 ghost 安装现在是否已损坏?
  3. 我去了/var/www/ghost中的ghost目录并尝试运行:

    sudo service ghost start

    但它返回了:

    Failed to start ghost.service: Unit ghost.service not found

    并试图停止,返回Unit ghost.service not loaded。我是否从正确的位置运行命令?

【问题讨论】:

  • which ghost 的任何输出?
  • @TarunLalwani,Ghost CMS ghost.org 通过 CLI 安装
  • 不,我的意思是从终端 which ghostghost start 执行命令会给你带来什么?
  • @TarunLalwani, which ghost 返回/usr/bin/ghost 当我转到var/www/ghost 并运行ghost start 我得到:✖ Starting Ghost An error occurred. Message: 'EACCES: permission denied, open '/var/www/ghost/.ghost-cli'' Debug Information: Node Version: v6.11.3 Ghost-CLI Version: 1.1.1 Environment: production Command: 'ghost start' Additional log info available in: /home/ubuntu/.ghost/logs/ghost-cli-debug-2017-09-23T04_00_01_360Z.log Please refer to https://docs.ghost.org/docs/v1/troubleshooting#section-cli-errors for troubleshooting.
  • 你试过sudo ghost start

标签: nginx ghost-blog ghost


【解决方案1】:

在运行 nginx 的几年中,我曾多次遇到过 nginx 背后的 Ghost 502 问题。我不确定我今天的原因是否与您的相同,但我观察到的是,在重新启动后,ghost 已将其端口号更改为与其 nginx 配置正在侦听的端口号不同的端口号。

我按照https://web.archive.org/web/20200807095031/https://www.danwalker.com/running-ghost-on-a-5-digital-ocean-vps/ 的这些指示为我解决了这个问题:

查看 ghost 在哪个端口上运行:

sudo netstat -plotn

检查它是否与 /etc/nginx/sites-enabled 中的 nginx 配置文件中的 proxy_pass 匹配。

在我的情况下,nginx 配置中的端口已增加到 2369,而实际节点进程在 2368 上运行。在我的 ghost 博客的 nginx 配置文件中将 proxy_pass 端口更改回 2368 为我解决了这个问题。

【讨论】:

  • 这是升级到 Ghost 2.6.0 后为我解决问题的方法。 Nginx 配置的端口为 2368,而 Ghost 在 2369 上运行。
  • 升级到 Ghost 2.18.1 后,此处相同。同一对端口,甚至是(2368,但现在是 2369)。
【解决方案2】:

我升级ghost后也遇到了同样的问题。

确保你ghost的配置文件中配置的端口号和你ghost站点的nginx配置文件中的proxy_pass匹配。

检查端口号 /var/www/ghost/config.production.json 匹配 nginx 配置文件中的 proxy_pass 端口。

/var/www/ghost/system/files/<yourDomainName>.<extension>.conf
/var/www/ghost/system/files/<yourDomainName>.<extension>-ssl.conf

在我的情况下,我必须在 nginx 配置文件中将 2368 更改为 2369 才能解决此问题。

确保在进行更改后重新启动 ghost 和 nginx

# restart your ghost site
cd /var/www/ghost/
ghost restart 
# restart nginx
sudo systemctl restart nginx

希望这对某人有所帮助。

【讨论】:

    【解决方案3】:

    显然,当我发布此问题时,它是由于 Ghost 团队正在修复的 Ghost CLI 中的一个错误。

    他们为我提供了在我的服务器上运行的这些说明:

    systemctl stop ghost_www-blogwebsite-com
    ghost update --force
    

    结果输出:

    stopping Ghost [skipped]
    Removing old Ghost versions [skipped]
    

    这解决了问题并更新到正确的版本。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2020-11-06
      • 1970-01-01
      • 2021-08-07
      • 2020-05-25
      • 2015-10-15
      相关资源
      最近更新 更多