Ghost CLI Re-Using Ports

I have multiple Ghost instances on my VPS.

When one Ghost instance is Stopped (but is still installed) and then I install another new Ghost instance in a different directory, the port number of the first instance is re-used.

Then, after I re-start the first instance, both URLs arrive at the same (the Ghost instance/site).

However, if the first Ghost instance is Started while I install the second Ghost instance, the CLI then sees that port as already in-use and chooses a different port.

Is there a way to either:

  1. Make the CLI recognize (so it will not re-use) the ports assigned to the other Stopped (but installed) Ghost instances?

  2. If not, how could I re-assign the port that was re-used in order to prevent or correct the conflict?

@vikaspotluri123 provided partial understanding in this post a couple of years ago…

Given that ghost ls knows about all the instances you have installed, even if they are not running, I guess you could put in a feature-request (or bug-report), that ghost install should not only check for ports in use, it should also check for ports already assigned…

FWIW ghost ls is based on ~/.ghost/config which can get out-of-step with reality. This config is just a list of folders where ghost is installed by this user.

1 Like

Oh - and to fix the config, you need to ghost stop the instance on the wrong port, fix the port in config.production.json, and then ghost start

Also, depending on your Nginx (or other webserver) setup, change the webserver config to use the new port. In Nginx this would be in your /etc/nginx/sites-enabled folder… which might link to ./system/files/nginx/myblog-domain-name from the blog install folder.

Don’t forget to systemctl restart nginx if you change any of its config.

1 Like

Hey @jeff thank you so much for both of those answers!

I’m running Litespeed webserver – any idea where in the file system I might find the equivalent of the sites-enabled folder in Lightspeed?

Sorry - not a server I’m familiar with :open_mouth: