Instructions to Install multiple Ghost Instances on the RPI with separate domains

Hi,

I’m on a Raspberry Pi 4B with 8GB of RAM. For the past 3 days, I have been trying to install multiple ghost blogs onto my RPI each with a custom domain from freenom.

I have followed these instructions here:

Which are the only ones that have worked for me out of the others on the inter web. I can get it all up an running but only on localhost. I have tried using a custom domain instead of localhost in the ghost setup but get that the domain name Aiyush.ml server is not responding when I go to type it in on the internet after the ghost installation has finished successfully.

I would really, really appreciate some step by step instructions that allow me to:

  1. Host multiple ghost blogs on a RPI 4B.
  2. Have different domain names and what to setup the DNS as.

I would really appreciate this,
If you would like more info please just ask :slight_smile:

Thanks
Aiyush

These are the instructions that I followed, they are a collection of ones online that I have found to give the least issues; I still have the domain issue and not sure how to do multiple instances yet. Since I seemed to mess up my last setup I just reinstalled the OS and am currently trying again. I am up to the ghost install stage:

Installing Ghost Steps

# I just reinstalled OS so everything is up to date

# Install NODE
curl -sL https://deb.nodesource.com/setup_12.x | sudo -E bash

# NPM install
sudo apt-get install -y nodejs

# Node Update to the latest release
sudo npm cache clean -f # Clear cache, I originally forgot the force flag so just redid it
sudo npm install -g n # Helper
sudo n stable # Install Latest stable version of node.js

# Packages: Webserver database and nodejs
# -y flag is default yes for any questions asked
sudo apt install nginx mariadb-server nodejs -y

# Globally install ghost: sudo npm install ghost-cli@latest -g 

# Configure MariaDB
sudo service mariadb stop 

# Restart in safe mode: sudo mysqld_safe --skip-networking &

# Login to MariaDB
sudo mariadb -u root

# Reload GRANT tables
FLUSH PRIVILEGES;

# Change passcode for the root user
ALTER USER 'root'@'localhost' IDENTIFIED BY 'my_new_password';

FLUSH PRIVILEGES; 
exit;

# Reboot to ensure any changes take place and get out of safe mode —> not sure this is necessary 
Sudo reboot

# Create a database and DB user for ghost
# Login using new passcode:
mariadb -uroot -p 

# Create new DB 
CREATE DATABASE ghost_cms;

# Create new user and password
CREATE USER 'ghost_cms'@'localhost' IDENTIFIED BY 'my_password';

# Set permissions
GRANT ALL PRIVILEGES ON ghost_cms.* TO 'ghost_cms'@'localhost';

FLUSH PRIVILEGES;
exit;

# Creating a system user for ghost and make it a sudo user

sudo useradd www-ghost
sudo usermod -aG sudo www-ghost

# Create a home directory for new user with correct permissions:
sudo mkdir /home/www-ghost && sudo chown www-ghost:www-ghost /home/www-ghost

# Password: sudo passwd www-ghost
# Enter password:

# Set Ghost Up
sudo mkdir -p /var/www/ghost

# Set owner of directory
sudo chown www-ghost:www-ghost /var/www/ghost && sudo chmod 775 /var/www/ghost && cd /var/www/ghost

# Switch User:
sudo su www-ghost

# Install Ghost: ghost install

# Message about compatibility: y
# Blog URL: http://aiyush.ml 
# MySQL hostname: localhost
# MySQL username: ghost_cms
# MYSQL password: {from before}
# Ghost DB name: ghost_cms
# Do you wish to setup NGINX: y
# Do you wish to set up  SSL: n (for now, I’ll need to do this later)
# Do you wish to setup Systemd: y




UPDATE:
This worked for the first ghost blog.
I’m now going to try it for another and will update here again.

UPDATE 2:
I want to try and get this on SSL
so try:

ghost setup ssl

I put in my email correctly and get the error:

â Setting up SSL
One or more errors occurred.

1) ProcessError

Message: Command failed: /bin/sh -c sudo -S -p '#node-sudo-passwd#'  /etc/letsencrypt/acme.sh --issue --home /etc/letsencrypt --domain aiyush.ml --webroot /var/www/ghost/system/nginx-root --reloadcmd "nginx -s reload" --accountemail agupta17@agsb.co.uk
[Fri 16 Jul 14:52:15 BST 2021] aiyush.ml:Verify error:No valid IP addresses found for aiyush.ml
[Fri 16 Jul 14:52:15 BST 2021] Please add '--debug' or '--log' to check more details.
[Fri 16 Jul 14:52:15 BST 2021] See: https://github.com/acmesh-official/acme.sh/wiki/How-to-debug-acme.sh

[Fri 16 Jul 14:52:00 BST 2021] Using CA: https://acme-v02.api.letsencrypt.org/directory
[Fri 16 Jul 14:52:04 BST 2021] Create account key ok.
[Fri 16 Jul 14:52:04 BST 2021] Registering account: https://acme-v02.api.letsencrypt.org/directory
[Fri 16 Jul 14:52:06 BST 2021] Registered
[Fri 16 Jul 14:52:06 BST 2021] ACCOUNT_THUMBPRINT='Cq235D4UzQTq4SGTeFryY4JwFpvMN8yUnw4aLH_TtfM'
[Fri 16 Jul 14:52:06 BST 2021] Creating domain key
[Fri 16 Jul 14:52:08 BST 2021] The domain key is here: /etc/letsencrypt/aiyush.ml/aiyush.ml.key
[Fri 16 Jul 14:52:08 BST 2021] Single domain='aiyush.ml'
[Fri 16 Jul 14:52:08 BST 2021] Getting domain auth token for each domain
[Fri 16 Jul 14:52:10 BST 2021] Getting webroot for domain='aiyush.ml'
[Fri 16 Jul 14:52:11 BST 2021] Verifying: aiyush.ml

Exit code: 1


Debug Information:
    OS: Raspbian GNU/Linux, v10
    Node Version: v14.17.3
    Ghost Version: 4.9.4
    Ghost-CLI Version: 1.17.3
    Environment: production
    Command: 'ghost setup ssl'

Additional log info available in: /home/www-ghost/.ghost/logs/ghost-cli-debug-2021-07-16T13_52_16_231Z.log

UPDATE 3:
I checked here:

And I think it is showing that it is fine?

  1. IP-Addresses
Host Type IP-Address is auth. ∑ Queries ∑ Timeout
aiyush.ml A 192.168.0.77
No Hostname found yes 1 0
AAAA yes
www.aiyush.ml A 192.168.0.77
No Hostname found yes 1 0
AAAA yes
*.aiyush.ml A Name Error yes
AAAA Name Error yes
CNAME Name Error yes

But I’m not too sure, if anyone could give guidance it would be much appreciated.
I have my DNS with freenom at the moment, but will change this in the future and I have it setup like this:

Record 1:
NO NAME
A - TYPE
3600 - TTL
192.168.0.77 - Target

Record 2:
WWW - NAME
A - TYPE
3600 - TTL
192.168.0.77 - TARGET

I managed to get ghost working, the SSL wasn’t working since it is not visible from outside the network, this is an NGINX issue that I need to solve with port forwarding somehow. At the moment, when I port forward I just get the default NGINX site that was setup and not the GhostCMS site. So…yes.