Trouble with Ghost in Docker + nginx reverse proxy

Hey :)
I have some trouble setting up my Ghost instance.
When I try to call Ghost via the URL (, I only get a “502 Bad Gateway” error message. Therefore I assume that there is a configuration error in the nginx config file on my side.
Could anyone take a look at my config file and help me out? I looked virtually everywhere to find a solution for this, but it seems like solutions that worked for others do not work for me :(

I am running Ghost in a Docker container, and I use nginx locally on my Ubuntu server to act as a reverse proxy plus SSL in combination with Lets Encrypt.

Ghost version: 5.13.2
nginx config:

 server {
          listen        80;

          location / {
            proxy_pass; # The port I assigned the container
            proxy_set_header Host $host;
            proxy_set_header X-Real-IP $remote_addr;
            proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
          # 2 lines below are to avoid Ghost https redirect bug
            proxy_set_header X-Forwarded-Proto $scheme;
            proxy_buffering off;

Ghost environment variables:
url: “

What is it I am missing here?

Thanks in advance for any help!

Why do you use docker? :thinking:

Because I prefer to use Docker for many things rather than installing everything directly on the machine

I run ghost in docker as well. But I. Using caddy instead of nginx.

Have a look at my guide, using this setup right now:

Thank you, I’ll take a look at your guide :)

While your guide is certainly well-written, I couldn’t use it for my setup.
This is what I did today, and my site works now:

  • Update the Docker image to the latest version (currently 5.14.2)
  • Accessed the page from the machine hosting it and created my account

Then, just for fun, I decided to access the URL on my PC - and now it works.
I don’t know what it was that caused the error, but it seems to be working - for now at least :D

Thanks anyway!