Admin endpoints (such as POST /ghost/api/admin/session) no longer works

I have hosted 3 Ghost instance in one machine. Nginx is correctly setup, I can visit them all as a viewer. However, only one of them has non-functioning Admin page! (at URL /ghost) All of them uses the same MySQL on the same machine, only different user and differently named database.

When clicking Sign In or Forgot, it would take really long time until it returns the red banner “There was a problem on the server.”. In the server that I keep it running with ghost run it logs :

[2022-09-28 11:10:00] INFO "POST /ghost/api/admin/session" 200 60036ms

Or in the case of Forgot

[2022-09-28 11:06:02] INFO "POST /ghost/api/admin/authentication/password_reset/" 200 60009ms

So looks like something timed out inside the Node logic of these endpoints. (yet it returns 200) How can I debug further what is the cause?

One hint is that I cannot run ghost export file on this problematic site either (the other 2 sites works), when the prompt " ? Enter your Ghost administrator email address" appears, entering random username does return the user name does not exist. BUT if I enter random password, it stuck at “☱ Exporting content” for equally long time (probably the same 60000 ms) before returning

Message: 'Response code 504 (Gateway Time-out)'


Debug Information:
    OS: Ubuntu, v20.04.4 LTS
    Node Version: v16.14.0
    Ghost Version: 5.16.2
    Ghost-CLI Version: 1.23.0
    Environment: production
    Command: 'ghost export file'

Stack: HTTPError: Response code 504 (Gateway Time-out)
    at EventEmitter.<anonymous> (/usr/lib/node_modules/ghost-cli/node_modules/got/source/as-promise.js:74:19)
    at processTicksAndRejections (node:internal/process/task_queues:96:5)
Path: /ghost/api/admin/session/

So, looks like the real error is 504, but it was not caught and returned as 200 in those front end usages. I am guessing if this export problem is fixed, it would also restore the ability to login as an admin for this site.

“Too many login attempt” works, right now I am being locked out for 30 minutes from my own server. That means each bugged attempt counted. (making it harder to debug)

EDIT : I have also tried going into MySql directly and clear the 1 row that exist in the sessions table, but it does not make any difference.