Suggested migration w/Nginx Reverse Proxy?

Hi there, I wonder what’s the suggested approach for migrating a Ghost site from ghost-cli to Docker.

I have the Nginx template, but I see the migration and `docker-compose.yml` file uses Caddy that could interfere with Nginx on my end.

Any help will be appreciate, the last Ghost verison is a major one!

I think I was in the same situation as you, as I have Nginx running multiple websites including proxying to a ghost blog. In my case, I also wanted to take care of my SSL certificates myself and not letting caddy do it. What ended up working for me was to run the migration process ( How To Install Ghost With Docker (preview) - Ghost Developer Docs ) with the following modifications:

  • `compose.yml` > `caddy` section:

    ports: 
      - "127.0.0.1:8081:8081"
    
  • `caddy\Caddyfile`

:8081 {
        [...]
        # Default proxy everything else to Ghost
        handle {
                reverse_proxy ghost:2369 {
                        # Preserve the original Host and forwarded headers from Nginx
                        header_up Host {http.request.host}
                        header_up X-Real-IP {http.request.header.X-Real-IP}
                        header_up X-Forwarded-For {http.request.header.X-Forwarded-For}
                        header_up X-Forwarded-Proto {http.request.header.X-Forwarded-Proto}
                        header_up Forwarded {http.request.header.Forwarded}
                }
        }
        [...]
}

While having in my nginx conf file, a server directive for my blog with the appropriate proxy_pass:

location / {
                proxy_set_header Host $host;
                proxy_set_header X-Forwarded-Proto $scheme;
                proxy_set_header X-Real-IP       $proxy_protocol_addr;
                proxy_set_header X-Forwarded-For $proxy_protocol_addr;
                proxy_pass         http://127.0.0.1:8081;
        }

1 Like

Hello, thanks for your reply. That means to use Caddy on docker and Nginx in front of it?

I wonder if it’s possible to use Nginx and avoid to proxy apps on Docker and their containers.

Yes

If you mean using nginx instead of caddy, you certainly can, by implementing the Caddyfile in your nginx conf. You would just have to take care of merging any changes in the upstream compose file with your custom, caddy-less one.

If you mean avoid docker whatsoever, the note in here says that the new Analytics feature is incompatible with Ghost-CLI, so you won’t be able to use it. But your OP was about migrating from Ghost-CLI to docker.

1 Like