Using Ghost 6 with an existing nginx/Docker setup

I am already hosting Ghost 5 in Docker containers, using nginx, Ghost, mysql 8, and Wordpress in their own containers, with a working certbot automatic renewal service, and a WebDAV folder. config (production.json) and content are already bind-mounted.

I am not particularly interested in migrating to Caddy, because I am not confident that its WebDAV support is well tested or secure. I am open to having both caddy and nginx run on my server, but the webdav server needs to be a subdomain of my ghost blog domain; the Wordpress site is a different domain entirely, and that can be served either via caddy or nginx.

What is the migration path suitable for me? I don’t care about web analytics but ActivityPub support is interesting.

also if someone can confirm the basic docker container architecture, that would be great. a cursory read of the default compose.yml makes it look like each service is running in its own container, but if I am not interested in analytics it looks like I should just delete the traffic_analysis and various Tinybird containers?

I have a similar setup and will be doing the migration soon, so while I can’t give you full step-by-step instructions, I can give you the gist of what needs to happen. You will essentially need to do 2 things:

  1. In the new official ghost docker compose, change the exposed caddy ports from 80/443 to something not in use. i.e.

        ports:
          - "8080:80"
          - "8443:443"
    
  2. add an nginx config that forwards all requests for your ghost domain to the caddy port. If you run nginx in docker, make sure it is also part of the ghost_network network. An example nginx config is below:

    server {
        listen 443 ssl http2;
        listen [::]:443 ssl http2;
    
        server_name <ghostdomain.com>;
    
        include /config/nginx/ssl.conf;
    
        location / {
            proxy_pass <caddy_ip>:<caddy_port>;
            proxy_http_version 1.1;
    
            proxy_set_header Host $host;
            proxy_set_header X-Real-IP $remote_addr;
            proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
            proxy_set_header X-Forwarded-Proto $scheme;
    
            proxy_set_header Upgrade $http_upgrade;
            proxy_set_header Connection "upgrade";
        }
    }