解决 Ghost 的 502 Bad Gateway 问题
1 min read

解决 Ghost 的 502 Bad Gateway 问题

今天,在重启Ghost后,访问页面出现了 502 bad gateway 错误。重启的过程没问题,日志也都正常。后来,经过Google搜索发现是因为 Ghost 的端口和 Nginx 的端口不一致造成的,一个是 2369,一个是 2368。

可以通过 sudo netstat -plotn 这个命令查看端口的占用情况。然后检查它是否与/etc/nginx/site-enabled中的nginx配置文件中的proxy_pass匹配。

解决方案,就是更改其中一个服务的端口,让两者一致。

只是现在还不清楚为什么会发生这种情况?网上有人说是因为升级了 ghost,但我也做升级。具体原因,还有待排查。

更详情的描述,可以参考下面这个链接:

What is the cause of the “502 Bad Gateway” after Ghost 1.8.7 update
I recently installed Ghost 1.8.4 and Nginx on my AWS ec2 Ubuntu 16.04 server. When I loaded my blog site, it correctly took me to the Ghost home page, from where I logged into Ghost admin. On the a...