Nginx redirection for self-hosted Ghost CMS

Hi guys! I’m trying to set up Ghost CMS in a Docker container and connect it to an existing site built with Gatsby through a subpath. My Gatsby front-end runs at port 9000 and Ghost CMS is running at port 9003.

What I want is:

  • http://my.domain --> Takes me to the Gatsby site (port 9000)
  • http://my.domain/admin --> Takes me to Ghost CMS’ /ghost subpath.

I have set up my nginx as below for the site but when i visit http://my.domain/admin, my Gatsby site redirects me to http://my.domain/ghost/ instead, which results in a 404.

Did I do something wrong with my Nginx configuration? Any help or advice is appreciated. Thank you!