Installing Second Ghost Instance on Single VPS

Hello,

My name is Michael and I am a fairly new Ghost convert. I am operating a blog running on version 1.22.4 with the latest version of the Ghost CLI. My blog is located at https://whenimbetter.com/ and is the only thing found on the domain.

I also operate a second website (https://mj94.net) that serves mostly as a file dump for me, though I plan to put something on the root domain in the future.

I am interested in setting up another instance of Ghost on https://blog.mj94.net and that is why I am coming to the Forums for some advice. After some research, I determined that is seems to be possible to run multiple Ghost instances on a single server, but most articles I have read detail the process using root domains and also as Ghost serving as the only thing found on the domain.

If anyone could offer any assistance to me regarding how to best complete this process, I would be very appreciative.

In summary:

  • I am currently running Ghost on my VPS running nginx on Ubuntu 16.04 LTS. It can be found at https://whenimbetter.com. Ghost is the only thing utilizing this domain.
  • I have a second domain (https://mj94.net) that currently hosts several folders and files on the same VPS. I would like to set up a second Ghost blog that points at https://blog.mj94.net.

Thank you. Please let me know if you have any questions or if I can elaborate further. :slight_smile:

Michael

Hey!

I’m running multiple instances of Ghost on the same VPS and the installation and configuration process is identical.

The only thing that changes is the port on which Ghost is listening to, i.e.

But yeah, I don’t remember it being well described in the Ghost documentation, I remember figuring this out from other sources.

Indeed, in theory is an nginx config thingie, but I think this use case should be described in the Ghost documentation as well.

Hope this helps!

1 Like

Forgive my ignorance: Do I have to install another instance of Ghost too, or do I just set up another nginx config?

Michael

Yes, in the directory, create a new folder instead of www (if you used the default), and do another Ghost config in the new directory.

Yes, just install another instance of Ghost in the directory of the second site and adjust its nginx config to match the new install port number.

You don’t need to adjust the nginx config. Installing a second instance should be the same difficulty as installing your first instance (the CLI finds the next open port if 2368 is taken)

It highly depends if you only run Ghost on that server or other websites as well (I, for example, run multiple websites on the same server, some with php-fpm). If your nginx config listens on the default ports of 80 and 443 you need to tell it to proxy to the different Ghost ports in order for the Ghost installs to be available to the world wide web (also if you manually config the nginx).

1 Like

In this case, there’s nothing to worry about, since everything is on its own subdomain :wink:

  • whenimbetter gets its own config supplied by ghost (with the port set to thewhenimbetter instance)
  • mj94 gets its custom config
  • blog.mj94 gets its own config supplied by ghost (with the port set to the blog.mj94 instance)
1 Like

Could be that easy :slight_smile:, but I didn’t dare let Ghost set up my nginx (was afraid it might want to treat it as a single site installation) so I worked with manual configurations.

Also, I had issues with the user setup as well :slight_smile: as I run nginx under an nginx user and I had to setup Ghost under a different (sudo) user and this made me have the Ghost installation folders with different ownership as compared to the other websites (which were all under nginx user).

Wait a minute, so I didn’t even need to update my MJ94 nginx config file?

Here’s what I have so far:

  1. The nginx file for my fully functional WIB blog.
  2. A database for the WIB blog.
  3. The current nginx file for mj94.net.
  4. A database for the MJ94 blog.

I tried following the directions here and here, but I didn’t want to mess anything up (but yes, I do have backups).

I also have the existing config files for the WIB which I copied and modified for the MJ94 blog.

So, what you’re saying, @vikaspotluri123, is I shouldn’t worry about the config? I should just install a new Ghost instance in the same place I installed it for WIB?

That’s right, you shouldn’t need to edit any nginx configuration files, if you trust the CLI :wink:

Assuming you have your current blog instance at /var/www/blog-whenimbetter/ghost, following that name scheme, you need to create an empty directory at /var/www/blog-mj94/ghost and run ghost install in that directory - everything will be setup for you, similar to how whenimbetter was setup.

It looks like you copied blog-whenimbetter to blog-mj94 - you don’t want to do this since this would copy whenimbetter-specific configuration over to mj94.

With regards to configuration, the reason you don’t need to modify nginx is because you’re serving (in the eyes of nginx) from 3 separate domains. If you were to serve this new instance from (for example) mj94.net/blog, you would need to modify the nginx configuration manually, because of the way nginx configuration works - you can’t configure the same domain multiple times (and subdomains are not the same thing as domains)

Great, thank you! Thanks for confirming that before I did it; I appreciate your help.

Right, that’s what I assumed—I was planning to manually configure it for the MJ94 blog, but your way (in theory) sounds easier.

I successfully installed it again, but realized in doing so, I broke my WIB install. WIB’s original install location was /var/www/ghost. By moving it to /var/www/blog-whenimbetter/ghost, I break subpages/links.

Is there a way I can properly move WIB’s /var/www/ghost to /var/www/blog-whenimbetter/ghost so that I can separate the two installs once MJ94 Blog is installed in /var/www/blog-mj94/ghost?

Once I’m able to seperate the two in their respective folders, I’ll be set to go! :)

I don’t know of an easy way to do this - The cli currently symlinks system files (see #469) so moving the installation directory would break those links.

So, there’s really no way to install a second instance of Ghost? Because it seems to just overwrite my existing WIB installation when I try.

You can install a second instance of ghost! I’m just not sure of an easy way to move an installation folder from one location to another

1 Like

My current functional blog is located in /var/www/ghost. Where would I install a new instance of Ghost to be able to have a second blog?

I can’t move the folders to separate the two, and when I try to install a second instance in /var/www/ghost, I’m told that because the current directory isn’t empty (because WIB’s Ghost is there), I can’t install another instance.

Basically, what I’m asking is: since we can’t move the files, where can I install a separate instance of Ghost that will work independently of my first and won’t overwrite it? :slight_smile:

Thank you for any clarification!
Michael

You can install it anywhere, such as /var/www/mj94-blog. Just note that once you pick the folder, you might want to stay with it :wink:

3 Likes

Thanks! Everything worked great. I may even reinstall my first blog and move it to ~/whenimbetter.com/blog, just so it’s a part of the same naming scheme as my new one at ~/mj94.net/blog, but that’s a project for another day.

Once I installed Ghost, created a new nginx config file, and set up Certbot, all was well!

I hope you all have a great day! :smiley:

Michael

1 Like

Pretty awesome, isn’t it?

1 Like

I love it. Again, thank you all!