How to configure Digital Ocean VPS to host multiple Ghost blogs

Hosting multiple ghost blogs on Digital Ocean.

Ghost is a free and open source blogging platform written in node.js (JavaScript) and it's designed for publishing. Moving from Wordpress to Ghost was a good idea, the site speed increased the dashboard is cleaner. But, Node.js is new compared to PHP, so when I needed to host multiple ghost blogs on the same VPS I've found the first downside of the platform. But after some research turned out that it's not so complicated after all.

This tutorial assumes you have created the one-click Ghost droplet on Digital Ocean and you have at least two domain names, which are pointing at your droplet.

So, let's start.
In your console, stop ghost to avoid problems:

service ghost stop

and nginx also:

service nginx stop

Now, we need to modify the nginx configuration. We need to define different paths in order to be able to handle requests separately. So, navigate to:

cd /etc/nginx/sites-enabled

Now, rename the ghost configuration file according to our first domain and then copy that to our second domain configuration file. We will change it later.

mv ghost myfirstdomain.conf
cp myfirstdomain.conf myseconddomain.conf

Then we have to modify our configuration files. So open the first one using nano or vim:

nano myfirstdomain.conf

and change the server_name to


in the server section we have the following code:

server {  
    listen 80 default_server;
    listen [::]:80 default_server ipv6only=on;

We have to edit our second configuration file, the server_name will be and in addition we have to change the proxy_pass value, in order to be able to split the traffic between the two sites. It can be any port number that is not used by another process, so let's say 2378.

proxy_pass http://localhost:2777  

We also need to change the server section of our second .conf file. It cannot be default server as well, so it will look like this:

server {  
    listen 80;
    listen [::]:80;

Then save the file and restart nginx.

service nginx restart

Now, we need to change the Ghost configuration. Go to the web root directory and create a directory for each Ghost blog:

cd /var/www

We need to copy the Ghost directory into our new folders:

cp -r ghost
mv ghost

Now, we can open our first Ghost configuration file and change the production url.

nano /var/www/

Change the value of url in the production section to the first domain's url:

production: {  
    url: ''

Save and close the file and then we have to do the same thing for the second Ghost site.

nano /var/www/

Of course, in the production section the value of the url will be corresponding to our second domain and in addition you have to scroll down to the server section and change the port:'2378'

production: {  
    url: ''
port: '2378'  

To be able to easily manage our Ghost blogs separately we have to create Upstart Scripts, which will allow us to start, stop, restart and check status of each ghost site. So first we have to delete the old System V Script

rm /etc/init.d/ghost

Now we can create the new configuration for our sites. Go to the init directory and create the first configuration file:

cd /etc/init
nano ghost-myfirstdomain.conf

and paste the following code:

# ghost-myfirstdomain

start on startup

    cd /var/www/
    npm start --production
end script  

save and close this file, then copy it to the second site's configuration file, and change accordingly

cp ghost-myfirstdomain.conf ghost-myseconddomain.conf

In our case the second configuration file will look like this:

# ghost-myseconddomain

start on startup

    cd /var/www/
    npm start --production
end script  

The last step is to start the Ghost blogs by running:

service ghost-myfirstdomain start
service ghost-myseconddomain start

If you visit each of your domains, you should see the Ghost blogging landing page.