Ghost Multisite setup is not working correctly

Hello everyone,

I have multiple WordPress blogs and I recently migrated one to Ghost. I set up the server on my own and install ghost on it. Using the official documentation, I migrated my wordpress site to ghost very easily. Now I am thinking to host another ghost instance on the same server, so in a separate directory I created another ghost instance using ghost install command.

It went pretty smooth. There was no error at all. But as soon as the second ghost instance started, the first ghost website redirected to the second newly created instance. I restarted nginx server, reloaded nginx config, restarted ghost, restarted the server, and even re-installed the entire server again. But first website starts getting redirected as soon as I create a second ghost instance.

I checked the nginx configs located at /etc/nginx/sites-enabled/ and configs for both ghost instances (domains) are correct. Each config points a domain name (server_name) to its ghost instance (/var/www/domain/system/nginx-root).

Please help me with the issue. I have been struggling with it for 2 days.

Server - VPS
OS - Ubuntu 22.04 64bit

Do you have your Ghost sites each set to use a different port (in the ghost config file), and do you have nginx pointed to each of those different ports? :) I’m guessing they’re both trying to use port 2368 by default…

Hello, Cathy. First of all, congratulations on your fantastic website,

I eventually fixed the problem after fighting it for over two days. Everything was correctly configured, including both nginx configurations were set to direct to different ports. The server name was the reason for the issue.

By default, when the ghost-cli configures nginx, it only sets the server name to non-www version. So all sites that use use the default configuration and point the to another site. The behaviour is unusual. Ideally, if the domain config in nginx is not created, nginx should use the default config, which should display the default nginx page (/var/wwww/html/index.html). Instead, when ghost creates the site, every domain that is not set up on the server but is pointed to it is bound to the random site.

I fixed the issue by manually creating nginx config. I entered server_name to non-ww as well as ww version of domain. Each domain is now linked to the correct webpage.

But, I believe not setting up ww version in the nginx config by ghost-cli is a problem. Please correct me if I am missing anything here.