Multiple Ghost Blogs on one Droplet

January 28, 2017 1.3k views
Ghost Ubuntu 16.04

I'm trying to set up three different ghost blogs on one droplet. I have followed the instructions in the tutorial: https://www.digitalocean.com/community/tutorials/how-to-serve-multiple-ghost-blogs-on-one-vps-using-nginx-server-blocks but right now all my domain names are pointing to the same blog instance and I can't seem to figure out where I have come wrong. I've attached the /etc/mginx/sites-enabled config files as well as the ghost/config files below. I've googled trying to find a solution but can't seem to come up with anything.

domain 1 nginx config

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

    server_name rachelmfisher.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;
    }
}

domain 2 nginx config

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

    server_name yougotalottanerve.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:2369;
        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;
    }
}

domain 3 nginx config

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

    server_name doombunnyctr.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:2778;
        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;
    }
}

domain1 ghost/config.js

// Prepared via DigitalOcean 1-Click provisioning
// # Ghost Configuration
// Setup your Ghost install for various [environments](http://support.ghost.org/config/#about-environments).

// Ghost runs in `development` mode by default. Full documentation can be found at http://support.ghost.org/config/

var path = require('path'),
    config;

config = {
    // ### Production
    // When running Ghost in the wild, use the production environment.
    // Configure your URL and mail settings here
    production: {
        url: 'http://rachelmfisher.com',
        mail: {},
        database: {

            // This part was prepared during first boot by DigitalOcean's 1-Click first-provisioning
            // This section is unique to this droplet
            client: 'mysql',
                connection: {
                  host     : '127.0.0.1',
                  user     : 'ghost',
                  password : 'aec8989f6d573cb93a65c41dc0122ebe4118e1ae0104a534',
                  database : 'ghost',
                  charset  : 'utf8'
            // End of per-droplet configuration
            },
            debug: false
        },

        server: {
            host: '127.0.0.1',
            port: '2368'
        }
    },

domain2 ghost/config.js

// Prepared via DigitalOcean 1-Click provisioning
// # Ghost Configuration
// Setup your Ghost install for various [environments](http://support.ghost.org/config/#about-environments).

// Ghost runs in `development` mode by default. Full documentation can be found at http://support.ghost.org/config/

var path = require('path'),
    config;

config = {
    // ### Production
    // When running Ghost in the wild, use the production environment.
    // Configure your URL and mail settings here
    production: {
        url: 'http://yougotalottanerve.com',
        mail: {},
        database: {

            // This part was prepared during first boot by DigitalOcean's 1-Click first-provisioning
            // This section is unique to this droplet
            client: 'mysql',
                connection: {
                  host     : '127.0.0.1',
                  user     : 'ghost',
                  password : 'aec8989f6d573cb93a65c41dc0122ebe4118e1ae0104a534',
                  database : 'ghost',
                  charset  : 'utf8'
            // End of per-droplet configuration
            },
            debug: false
        },

        server: {
            host: '127.0.0.1',
            port: '2369'
        }
    },

domain3 ghost/config.js

// Prepared via DigitalOcean 1-Click provisioning
// # Ghost Configuration
// Setup your Ghost install for various [environments](http://support.ghost.org/config/#about-environments).

// Ghost runs in `development` mode by default. Full documentation can be found at http://support.ghost.org/config/

var path = require('path'),
    config;

config = {
    // ### Production
    // When running Ghost in the wild, use the production environment.
    // Configure your URL and mail settings here
    production: {
        url: 'http://doombunnyctr.com',
        mail: {},
        database: {

            // This part was prepared during first boot by DigitalOcean's 1-Click first-provisioning
            // This section is unique to this droplet
            client: 'mysql',
                connection: {
                  host     : '127.0.0.1',
                  user     : 'ghost',
                  password : 'aec8989f6d573cb93a65c41dc0122ebe4118e1ae0104a534',
                  database : 'ghost',
                  charset  : 'utf8'
            // End of per-droplet configuration
            },
            debug: false
        },

        server: {
            host: '127.0.0.1',
            port: '2778'
        }
    },

Any assistance would be greatly appreciated!

2 comments
  • I was finally able to get this working. Turns out that the default for ghost (when installed via Digital Ocean one click install) is a mysql database and not the sqlite3 databases used in the tutorials. All three ghost installs were using the same database. Created two additional databases and changed the config.js file to match.

  • @Elenaltarien I am totally new to D.O, I am looking to add multiple ghost blog to a single droplet as well, can you elaborate on your solution. I mean to say how you created the 2 additional databases and change in config. thanks

1 Answer

@Elenaltarien

I was actually about to comment on that -- glad you were able to get that resolved!

One thing I would comment on is what you've exposed in the Ghost Configuration (your MySQL user and password). If those are valid connection details for your database, please make sure you change at least the password as it's now exposed and would allow anyone to potentially attempt to connect.

  • I have the same problem, and I found the MySQL user and password in Ghost Configuration, turns out the user 'ghost' doesn't have access to create a new database.

    It must have a root user, but I can't find the password.

    • @jay1803

      If you setup a one-click image, there should be a MOTD message when you login via SSH that tells you where the root password for MySQL is. Last I recall, it's stored to a file when the image is setup on your Droplet, but you'd need to check it for the location.

      If you installed MySQL manually using the package manager, some of them force you to set a root password, some do not and you need to set it up yourself, which can be done by running the mysql_secure_installation from the CLI.

      On a fresh installation, only the root user can setup/create databases.

Have another answer? Share your knowledge.