# Gateway timeout when logging in to /ghost

**URL:** <https://forum.ghost.org/t/gateway-timeout-when-logging-in-to-ghost/58012>\
**Category:** Self-hosting\
**Created:** [June 9, 2025, 3:14pm UTC](https://forum.ghost.org/t/gateway-timeout-when-logging-in-to-ghost/58012 "2025-06-09T15:14:51Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![wickswords](https://sea1.discourse-cdn.com/flex015/user_avatar/forum.ghost.org/wickswords/32/27279_2.png) [@wickswords](https://forum.ghost.org/u/wickswords)\
**Post date:** [June 9, 2025, 3:14pm UTC](https://forum.ghost.org/t/gateway-timeout-when-logging-in-to-ghost/58012/1 "2025-06-09T15:14:51Z")

</div>

When trying to log in to the admin page from a new computer, I get a Gateway 504 timeout error. The site otherwise works fine, and my existing logged-in session works fine as well. No errors in the server logs, or even acknowledgment of the “session” API call.

Hosting on Digital Ocean with the latest version of Ghost, v5.121.0.

 ![image](https://us1.discourse-cdn.com/flex015/uploads/ghost2/original/3X/5/d/5d65ced67062e25b0c63c26c8f338aa8d651585d.png)

 ![image](https://us1.discourse-cdn.com/flex015/uploads/ghost2/original/3X/8/a/8aa82e958add5f43c72643d3a16d634e0ca1cbca.png)

---

<div class="post-metadata">

**Author:** ![vikaspotluri123](https://sea1.discourse-cdn.com/flex015/user_avatar/forum.ghost.org/vikaspotluri123/32/24_2.png) [@vikaspotluri123](https://forum.ghost.org/u/vikaspotluri123)\
**Post date:** [June 9, 2025, 3:17pm UTC](https://forum.ghost.org/t/gateway-timeout-when-logging-in-to-ghost/58012/2 "2025-06-09T15:17:26Z")

</div>

> [@wickswords](#):
>
> No errors in the server logs, or even acknowledgment of the “session” API call.

Does this include the error log (`ghost log -e`)? Note that I think I saw that emails can take 15 minutes to fail, so you might not see any messages until then.

If you haven’t disabled 2fa, you’ll need to make sure you have email set up in your config file

---

<div class="post-metadata">

**Author:** ![wickswords](https://sea1.discourse-cdn.com/flex015/user_avatar/forum.ghost.org/wickswords/32/27279_2.png) [@wickswords](https://forum.ghost.org/u/wickswords)\
**Post date:** [June 9, 2025, 3:21pm UTC](https://forum.ghost.org/t/gateway-timeout-when-logging-in-to-ghost/58012/3 "2025-06-09T15:21:31Z")

</div>

Thanks. Error log shows only this, which is received when the login page initially loads:

```auto
[2025-06-09 15:04:21] ERROR "GET /ghost/api/admin/users/me/?include=roles" 403 3ms

NAME: NoPermissionError
MESSAGE: Authorization failed

level: normal

"Unable to determine the authenticated user or integration. Check that cookies are being passed through if using session authentication."
NoPermissionError: Authorization failed
    at authorizeAdminApi (/var/www/ghost/versions/5.121.0/core/server/services/auth/authorize.js:33:25)
    at Layer.handle [as handle_request] (/var/www/ghost/versions/5.121.0/node_modules/express/lib/router/layer.js:95:5)
    at next (/var/www/ghost/versions/5.121.0/node_modules/express/lib/router/route.js:149:13)
    at authenticate (/var/www/ghost/versions/5.121.0/core/server/services/auth/session/middleware.js:55:13)
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)

```

Unless ghost config format has changed, SMTP is set up and has been working fine for years.

---

<div class="post-metadata">

**Author:** ![vikaspotluri123](https://sea1.discourse-cdn.com/flex015/user_avatar/forum.ghost.org/vikaspotluri123/32/24_2.png) [@vikaspotluri123](https://forum.ghost.org/u/vikaspotluri123)\
**Post date:** [June 9, 2025, 4:37pm UTC](https://forum.ghost.org/t/gateway-timeout-when-logging-in-to-ghost/58012/4 "2025-06-09T16:37:23Z")

</div>

Can you check again now, just to be safe?

If Ghost logs don’t show anything, can you check your nginx logs?

---

<div class="post-metadata">

**Author:** ![wickswords](https://sea1.discourse-cdn.com/flex015/user_avatar/forum.ghost.org/wickswords/32/27279_2.png) [@wickswords](https://forum.ghost.org/u/wickswords)\
**Post date:** [June 9, 2025, 5:08pm UTC](https://forum.ghost.org/t/gateway-timeout-when-logging-in-to-ghost/58012/5 "2025-06-09T17:08:25Z")

</div>

Nothing different in the ghost logs. Nginx logs show:

```auto
root@ryansouthwickauthor-newsletter:/var/log/nginx# cat error.log
2025/06/09 11:52:55 [error] 13131#13131: *10636 open() "/var/www/ghost/system/nginx-root/.well-known/traffic-advice" failed (2: No such file or directory), client: 64.233.173.160, server: newsletter.ryansouthwickauthor.com, request: "GET /.well-known/traffic-advice HTTP/1.1", host: "newsletter.ryansouthwickauthor.com"
2025/06/09 14:49:33 [error] 13131#13131: *10974 upstream timed out (110: Unknown error) while reading response header from upstream, client: 206.124.26.2, server: newsletter.ryansouthwickauthor.com, request: "POST /ghost/api/admin/session HTTP/2.0", upstream: "http://127.0.0.1:2368/ghost/api/admin/session", host: "newsletter.ryansouthwickauthor.com", referrer: "https://newsletter.ryansouthwickauthor.com/ghost/"
2025/06/09 14:50:20 [error] 13131#13131: *11030 upstream timed out (110: Unknown error) while reading response header from upstream, client: 206.124.26.2, server: newsletter.ryansouthwickauthor.com, request: "POST /ghost/api/admin/session HTTP/2.0", upstream: "http://127.0.0.1:2368/ghost/api/admin/session", host: "newsletter.ryansouthwickauthor.com", referrer: "https://newsletter.ryansouthwickauthor.com/ghost/"
2025/06/09 15:02:09 [error] 13131#13131: *11074 upstream timed out (110: Unknown error) while reading response header from upstream, client: 206.124.26.2, server: newsletter.ryansouthwickauthor.com, request: "POST /ghost/api/admin/authentication/password_reset/ HTTP/2.0", upstream: "http://127.0.0.1:2368/ghost/api/admin/authentication/password_reset/", host: "newsletter.ryansouthwickauthor.com", referrer: "https://newsletter.ryansouthwickauthor.com/ghost/"
2025/06/09 15:06:03 [error] 13131#13131: *11074 upstream timed out (110: Unknown error) while reading response header from upstream, client: 206.124.26.2, server: newsletter.ryansouthwickauthor.com, request: "POST /ghost/api/admin/session HTTP/2.0", upstream: "http://127.0.0.1:2368/ghost/api/admin/session", host: "newsletter.ryansouthwickauthor.com", referrer: "https://newsletter.ryansouthwickauthor.com/ghost/"
2025/06/09 15:16:28 [error] 13131#13131: *11167 upstream timed out (110: Unknown error) while reading response header from upstream, client: 206.124.26.2, server: newsletter.ryansouthwickauthor.com, request: "POST /ghost/api/admin/session HTTP/2.0", upstream: "http://127.0.0.1:2368/ghost/api/admin/session", host: "newsletter.ryansouthwickauthor.com", referrer: "https://newsletter.ryansouthwickauthor.com/ghost/"

```

---

<div class="post-metadata">

**Author:** ![vikaspotluri123](https://sea1.discourse-cdn.com/flex015/user_avatar/forum.ghost.org/vikaspotluri123/32/24_2.png) [@vikaspotluri123](https://forum.ghost.org/u/vikaspotluri123)\
**Post date:** [June 10, 2025, 1:09pm UTC](https://forum.ghost.org/t/gateway-timeout-when-logging-in-to-ghost/58012/6 "2025-06-10T13:09:34Z")

</div>

If there are no non-error Ghost logs around the same time as NGINX (within 20 minutes) to `/ghost/api/admin/session`, that’s a bit odd, since other requests seem to be going through

---

<div class="post-metadata">

**Author:** ![kamasuPaul](https://sea1.discourse-cdn.com/flex015/user_avatar/forum.ghost.org/kamasupaul/32/37159_2.png) [@kamasuPaul](https://forum.ghost.org/u/kamasuPaul)\
**Post date:** [August 5, 2025, 2:22pm UTC](https://forum.ghost.org/t/gateway-timeout-when-logging-in-to-ghost/58012/7 "2025-08-05T14:22:31Z")

</div>

In case anyone comes here looking for an answer: The problem stems from the warning in the ghost logs.

![image](https://us1.discourse-cdn.com/flex015/uploads/ghost2/original/3X/7/3/7384cc2e3380c34506073b0f8da499a6685dc76d.png)

It occurs because ghost is trying to send an email when you try to log in, so it fails due to email settings not being configured. The solution is to fix your configuration and set up email, as shown below // config.production.json

“mail”: {  
“transport”: “SMTP”,  
“options”: {  
“service”: “Mailgun”,  
“host”: “[smtp.mailgun.org](http://smtp.mailgun.org)”,  
“port”: 465,  
“secure”: true,  
“auth”: {  
“user”: “postmaster@example.mailgun.org”,  
“pass”: “1234567890”  
}  
}  
},

Refer to the docs

> **[Configuration - Ghost Developer Docs](https://docs.ghost.org/config)**
>
> For self-hosted Ghost users, a custom configuration file can be used to override Ghost’s default behaviour. This provides you with a range of options to configure your publication to suit your needs.
