502 after fresh installation

Hello,
I just completed a fresh installation on Ubuntu 22.04 self hosted on AWS EC2. I followed exactly the official Ghost documentation. After the Ghost install completed I opened a browser to my domain barryleeblogs.com and received a 502 Bad Gateway Error. I also tried barryleeblogs.com/ghost. Surprisingly I did not see any tutorials on what the first step is after you create the installation but I assume some default site comes up.
Ghost doctor runs fine, no issues.
I am using AWS Route 53 for DNS
The nginx log: Ok I tried to post the error log entry but I couldn’t post because the forum told me that new users cannot post more than 3 links, since I have no links I assume it is the log

Since the Ghost installer automates everything, I am not sure what to look for.

Thank you

nginx log: > 2023/11/13 16:17:46 [error] 5826#5826: *20 connect() failed (111: Unknown error) while connecting to upstream, client: 181.136.50.102, server: barryleeblogs.com, request: “GET /ghost HTTP/2.0”, upstream: “http://127.0.0.1:2368/ghost”, host: “barryleeblogs.com

The logs indicate that there is an issue in the connection between Nginx and Ghost.

Is Ghost actually running on your server? You can list all running Ghost instances with ghost ls

1 Like

Gentlemen,
Note that I am installing Ghost on GCP and I am getting the same error, although I have followed the suggestions from this link, still no luck

Appreciate your assistance.

Same question to you. Is your Ghost instance actually running?

Also, the link you posted talks about an update. OP mentioned that he installed it fresh.

Indeed, its a fresh installation and its running.
Just posted it as a potential workarround, since i saw that port has changed from the initial one mentioned in the config files, post changing them, i can see ngnix error logs , the old port and not the newest one post editing the files

Thank you, so I discovered that Ghost when started shuts down immediately. From journalctl -u ghost_barryleeblogs

500
Nov 13 19:26:16 ip-172-31-12-71 node[6963]: Error Code:
Nov 13 19:26:16 ip-172-31-12-71 node[6963]: ER_ACCESS_DENIED_NO_PASSWORD_ER>
Nov 13 19:26:16 ip-172-31-12-71 node[6963]: ----------------------------------->
Nov 13 19:26:16 ip-172-31-12-71 node[6963]: Error: Access denied for user 'root>
Nov 13 19:26:16 ip-172-31-12-71 node[6963]: at /var/www/barryleeblogs/versi>
Nov 13 19:26:16 ip-172-31-12-71 node[6963]: at Packet.asError (/var/www/bar>
Nov 13 19:26:16 ip-172-31-12-71 node[6963]: at ClientHandshake.execute (/va>
Nov 13 19:26:16 ip-172-31-12-71 node[6963]: at Connection.handlePacket (/va>
Nov 13 19:26:16 ip-172-31-12-71 node[6963]: at PacketParser.onPacket (/var/>
Nov 13 19:26:16 ip-172-31-12-71 node[6963]: at PacketParser.executeStart (/>
Nov 13 19:26:16 ip-172-31-12-71 node[6963]: at Socket. (/var/www>
Nov 13 19:26:16 ip-172-31-12-71 node[6963]: at Socket.emit (node:events:517>
Nov 13 19:26:16 ip-172-31-12-71 node[6963]: at addChunk (node:internal/stre>
Nov 13 19:26:16 ip-172-31-12-71 node[6963]: at readableAddChunk (node:inter>
Nov 13 19:26:16 ip-172-31-12-71 node[6963]: at Readable.push (node:internal>
Nov 13 19:26:16 ip-172-31-12-71 node[6963]: at TCP.onStreamRead (node:inter>

EC2 does not allow root logon, and if you do something like

sudo su root

or to enter mysql with root, no password is required.
So this is the issue, not sure the steps to resolve?

Indeed, running “sudo systemctl status ghost_www-xxxxxxx” confirms that’s restarting instantly

I’m Doubting if this release only has this bug and not previous Ghost releases :thinking:

Success!
So apparently the official Ghost installation instructions bypass any setup for mysql other than installing it. But a root password needs to be set. I discovered that the ghost install did not even create a database. I solved by doing the following:

  1. ghost uninstall
  2. set a root password in mysql
  3. ran the sudo mysql_secure_installation
  4. created a database and database user for ghost
  5. ghost install
    Here is a how to article with the steps
2 Likes