Setup another Ghost blog on one DigitalOcean VPS

As promised, I'd share how to setup more than one Ghost blog on one DO Ghost VPS.

After finish this step, you already have a Ghost blog setup. But if you need another one, you can setup one more on the same VPS easily as well.

  1. To make things simple, I'd use a Ghost Docker image on top of the droplet. Just go to https://hub.docker.com/_/ghost/ and pull the image firstly to your VPS.

  2. After pulled the image, run

    docker run --name ghost-blog -p 8088:2368 -d -v ~/apps/ghost_blog:/var/lib/ghost ghost
    

    Now you have another running Ghost blog on this VPS. Check it at your.vps.ip:8088. If there is no problem, you'd get a Ghost setup page. Do the same setting as the previous setup http://leijing.me/two-ghost-blogs-on-one-digitalocean-vps/.

  3. Edit /etc/nginx/sites-enabled/ghost config file. You can refer below

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

    server_name my-ghost-blog.com; # Replace with your domain

    root /usr/share/nginx/html;
    index index.html index.htm;

    client_max_body_size 10G;

    location / {
        proxy_pass http://localhost:2368;
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
        proxy_set_header Host $http_host;
        proxy_set_header X-Forwarded-Proto $scheme;
        proxy_buffering off;
    }
}
server {
    listen 80;

    server_name anothersite.com *.anothersite.com; # Replace with your domain

    client_max_body_size 10G;

    location / {
        proxy_pass http://localhost:8088;
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
        proxy_set_header Host $http_host;
        proxy_set_header X-Forwarded-Proto $scheme;
        proxy_buffering off;
    }
}

Then run nginx -s reload to activate the above config.

At last, connect your domain provider and DO's name server. There are plenty of instructions online about how to do them.

Done. Now you are able to visit both of sites with their different domain name on the same DO VPS.