Ghost restart "Could not communicate with Ghost"

Okay, the problem (diagnosed by trying ghost run) seems to be that I didn’t include the protocol (https://) in my url. I reset to my original url and was able to run ghost restart successfully!

But I’m still getting the 502 Bad Gateway errors. sudo tail -f /var/log/nginx/error.log shows me

2023/06/15 18:22:31 [error] 854#854: *785 connect() failed (111: Unknown error) while connecting to upstream, client: AAA, server: BBB, request: "GET / HTTP/2.0", upstream: "http://127.0.0.1:2368/", host: "CCC"

Dead ends:

✔ Checking system Node.js version - found v16.17.0
✔ Checking logged in user
✔ Ensuring user is not logged in as ghost user
✔ Checking if logged in user is directory owner
✔ Checking current folder permissions
✔ Checking system compatibility
✔ Checking for a MySQL installation
+ sudo systemctl is-active ghost_writing-jdecampos-com
Instance is currently running
ℹ Validating config [skipped]
✔ Checking folder permissions
✔ Checking file permissions
✔ Checking content folder ownership
✔ Checking memory availability
✔ Checking binary dependencies
✔ Checking free space
✔ Checking systemd unit file
✔ Checking systemd node version - found v16.17.0

A possible solution from another post on the same issue:

I am not familiar with netstat but I do see this line in my netstat -plant output:

tcp 0 0 127.0.0.1:2369 0.0.0.0:* LISTEN 7829/node

I tried updating the port numbers in /etc/nginx/sites-enabled/XXX.conf and /etc/nginx/sites-enabled/XXX-ssl.conf from 2368 to 2369 and then restarting with ghost restart. Seems to have had no effect.