Skip to content

Multiple Ghost Sites on 1 Digital Ocean Droplet

Documenting the things that I've done that worked.
Had to pull from multiple different places YouTube, Blogs, Forums etc

1 Digital ocean sign up - create an account


2 Choose a server - found that it needs the 2gb minimum because of the install . choose premium. can install 1 ghost on the 1Gb but didn't work for the 2nd. so i upgraded. once you get everything set up and installed you can try resizing the droplet back down if you want to try and save on costs. but running multiple simple low traffic sites on 1 $14 is a great deal - i have 4 with no issues. As traffic increases i will just resize up the droplet

BasicPremium AMD1 vCPU2 GB
25 GB2 TB$14/mo

3 1 Click install - choose server location closest to you & audience

4 Set up the DNS with the IP

5 Terminal part - get into the IP and run the steps to install ghost

6 Once you have 1 installed you can go ahead and start installing the other ones

Adding another Ghost Instance on the Same Droplet

Before installing another ghost instance, you need to find the root password for your MySQL database. Digital Ocean created a password file at the root of your server. To access it, type:

nano /root/.digitalocean_password

Copy the password and paste it somewhere safe on your computer because you will need it in a couple of minutes.

Press CTRL+X to exit the nano editor

Next, you need to create a directory for your new blog. Replace “ghostfolder2” with the name of your second blog.

sudo mkdir -p /var/www/ghostfolder2

Now you will assign the user “ghost-mgr” as the owner of that directory.

sudo chown ghost-mgr:ghost-mgr /var/www/ghostfolder2

Finally, you will update the permissions.

sudo chmod 775 /var/www/ghostfolder2

Once the directory is created, you need to log in as the ghost-mgr account.

sudo -i -u ghost-mgr

When you switch to the “ghost-mgr” user, you will be placed in the home directory for ghost-mgr so you need to navigate to the folder you just created.

cd /var/www/ghostfolder2

Now you can install a new instance of ghost

ghost install

Options
When in doubt, accept the defaults.

Enter your blog URL: <type in your domain>
Enter your MySQL hostname: localhost
Enter your MySQL username: root
Enter your MySQL password: <Paste your mysql password>
Enter your Ghost database name: <yourfoldername_prod>
Do you wish to set up “ghost” mysql user? Yes
Do you wish to set up Nginx? Yes
Do you wish to set up SSL? Yes
Enter your email (For SSL Certificate) <your email address>
Do you wish to set up Systemd? Yes
Do you want to start Ghost? Yes


6 By doing this you can install as many ghost installs as the server can handle. I did 4 without issues. You will be able to login to each site from yourdomain.com/ghost

7 SSL cert for www - this was an issue for me. so https://yourdomain.com/ was great for all sites but https://www.yourdomain.com/ didn't work

this can be set up for a primary domain by going to cloudflare and setting up a CNAME record of www to go to the IP

go into each site
sudo nano /etc/nginx/sites-available/themattlok.com-ssl.conf

add a redirect www will go to non-ww

server {
listen 443 ssl http2;
listen [::]:443 ssl http2;
server_name www.themattlok.com;

ssl_certificate /etc/letsencrypt/themattlok.com/fullchain.cer;
ssl_certificate_key /etc/letsencrypt/themattlok.com/themattlok.com.key;

return 301 https://themattlok.com$request_uri;

}

but what about sub domains

so the above works on primary domary domains but it's slightly different with subdomains because Cloudflare free universal SSL doesn't cover. You can pay for this but at this stage i didn't want too.

you'll want to A-name your sub domain to the IP and turn off the proxy

while again doing the redirect of the www to the non-www in the server



here's what i done

Save and Test Your Configuration:
After adding the new server block, save your changes and test the Nginx configuration for syntax errors by running:

bashCopy code

sudo nginx -t

If the test is successful, reload Nginx to apply the changes:

bashCopy codesudo systemctl reload nginx

still need to do something else with SSL

You need a certificate that covers both themattlok.com and www.themattlok.com. Here's how to expand your certificate to include the www subdomain using Certbot (which is commonly used with Let's Encrypt):

  1. Install Certbot and the Nginx plugin (if not already installed):

bashCopy codesudo apt update
sudo apt install certbot python3-certbot-nginx

  1. Run Certbot to expand the certificate:

bashCopy code sudo certbot --nginx -d themattlok.com -d www.themattlok.com

  1. Follow the prompts. Certbot will ask if you want to expand the certificate to include www.yourdomain.com. Confirm that.
  2. Once the process completes, Certbot will automatically update your Nginx configuration with the new certificate paths.
  3. Test the Nginx configuration and reload if successful:bashCopy codesudo nginx -t
    sudo systemctl reload nginx
  4. Clear your browser cache and try accessing www.yourdomain.com again.

This process will ensure both your root domain and the www subdomain are covered by the SSL certificate.

www.sub.<yourdomain>.com is a second-level subdomain
but

sub.<yourdomain>.com is still a first level subdomain

?

i don't care too much about needing the www as long as it doesn't go to an error page/ redirecting to the non-www is fine unless it hurts SEO or something weird?

For SEO and user experience, it's generally recommended to choose either www or non-www and redirect the other to your chosen default. This is to avoid duplicate content issues and ensure that your users reach the correct address whether or not they type www.

Having www or not is mostly a matter of personal or brand preference; neither option should inherently hurt your SEO as long as you are consistent and have the proper redirects in place. Search engines like Google understand that www is often used as a subdomain for historical reasons and treat www.domain.com and domain.com as the same entity if they are correctly redirected to each other.

If you don't need the www for your subdomains, you can set up a redirect from www.sub.<yourdomain>.com to sub.<yourdomain>.com within Cloudflare:

  1. Go to the Page Rules section of your Cloudflare dashboard.
  2. Create a new rule for www.sub.*.<yourdomain>.com/*.
  3. Set the rule to forward to https://sub.<yourdomain>.com/$1 with a 301 permanent redirect status code.

This will catch any requests to the www version of your subdomains and redirect them to the non-www version, ensuring that your visitors always end up at the correct URL.



additional details

The minimum RAM for ghost installation is 1GB

Ghost needs 1GB of ram because the installation and updating processes use yarn and npm, which are resource intensive. I have run into issues with memory errors when trying to update my ghost blog, which I resolved by creating a swap file. Swap space is slow compared to ram, so you do not want to rely on a swap file to run your extra blog instances.

Note: How much RAM and disk space are needed will vary greatly depending on the size of files, number of files, and number of visitors. I am providing general numbers based on my experiences with my sites.

RAM

Disk Space

Recommended Droplet Size

$14/mo Premium AMD with NVME SSD (50GB disk space and 2GB ram) should be able to handle 6–8 Ghost small blogs without problems.

Note: I read several blogs stating the performance on the “AMD” far surpassed the basic and intel servers.