Setting up 2 blogs on one domain


#1

I want to set up two Ghost Blogs (Instances) on a single domain.

  1. http://example.com/blog1
  2. http://example.com/blog2

Now, I created two directories blog1 and blog2 in my www folder. I installed Ghost via ghost install command in both of them.

While installing, I set the nginx, systemd and ssl to NO, as I want to customize the nginx file.

I added this code to my nginx server conf.

location /blog1 {
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
        proxy_set_header X-Forwarded-Proto $scheme;
        proxy_set_header X-Real-IP $remote_addr;
        proxy_set_header Host $http_host;
        proxy_pass http://127.0.0.1:2368;
        proxy_redirect off;
    }

    location /blog2 {
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
        proxy_set_header X-Forwarded-Proto $scheme;
        proxy_set_header X-Real-IP $remote_addr;
        proxy_set_header Host $http_host;
        proxy_pass http://127.0.0.1:2369;
        proxy_redirect off;
    }

Now, I cannot understand how to set up systemd for both of them. If I allow Ghost to set up, then it does not work as it rewrites the first instance while installing the second.

If I try to modify the systemd and start Ghost, I’m getting this error

A SystemError occurred.

Message: Systemd process manager has not been set up or is corrupted.
Help: Run ghost setup systemd and try again.

#2

When installing, did you pass Ghost the full url for each blog including the subdirectory?

My advice would be to install both blogs using Ghost-CLI fully, so that nginx, systemd and ssl are fully configured for you. Then, once the two blogs are up and running you can customize the nginx files to your hearts content.

If installing 2 blogs really isn’t working with Ghost-CLI, that’s definitely a bug that we would want to look into and fix.


#4

Yes. I did specific the whole URL including the sub directory.

I tried it by allowing ghost to set up the nginx, systemd and ssl configurations, but it just doesn’t work.

So I set these files myself. I think it’s a bug.

Let me know if you need any more information from my side. Would be happy to be involved in solving this if it is a bug.

Loving Ghost as a platform and this is how I can contribute back my bit. :slight_smile:


#5

Ok that definitely sounds like a use case we need to fix. It’s absolutely supposed to be possible!

Would you be able to raise a bug following the bug report template here? https://github.com/TryGhost/Ghost-CLI/issues/new/choose

If not I can raise it, but it would be very helpful if you were able to step through the process again and document what exactly went wrong, any errors or debug logs that were available, etc. The more detail we have the easier it is to find and ship a fix :slight_smile:

Thanks!


#6

Sure. I’ll do it. :100:


#7

Issue is created.


#8

I wasn’t sure if I should start a new topic, but I’m not so sophisticated with nginx.

I’ve managed to set up ghost so that I have two separate installs, using vhosts.

The problem I have is that both domains (one for each install) are pointing to the same install, and I’m not clear on how to set it up so that install a and install b both point to two different domains on the same server.

Server - Hetzner OS - Ubuntu 18.04.1 Node - 8.13.0 NPM - 6.4.1 MySQL - 14.14 Nginx - 1.14

So both installs exist, both run, but both seem to direct to one blog.

Thanks


#9

Seems the latest update has fixed the problem, thanks