Synology: Install Ghost Blogging Using MySQL as Database

Synology: Install Ghost Blogging Using MySQL as Database

Ghost is a free and open source blogging platform like WordPress and Grav. Ghost is written in JavaScript and distributed under the MIT License, designed to simplify the process of online publishing for individual bloggers as well as online publications. Ghost CMS is actually used by millions of people. The Ghost app is a powerful app for new-media creators to publish, share, and grow a business around their content. It comes with modern tools to build a website, publish content, send newsletters & offer paid subscriptions to members. In this step by step guide I will show you how to install Ghost with MySQL as database on your Synology NAS using Docker & Portainer. Note: If you want to install Ghost without MySQL as database, follow my other Ghost Installation guide.

Note: This guide works perfectly with the latest Ghost 5.16.0 release.

  • STEP 1

Please Support My work by Making a Donation.

  • STEP 2

Install Portainer using my step by step guide. If you already have Portainer installed on your Synology NAS, skip this STEP. Attention: Make sure you have installed the latest Portainer version.

  • STEP 3

Make sure you have a synology.me Wildcard Certificate. Follow my guide to get a Wildcard Certificate. If you already have a synology.me Wildcard certificate, skip this STEP.

  • STEP 4

Go to Control Panel / Network / Connectivity tab/ Check Enable HTTP/2 then click Apply. Follow the instructions in the image below.

Ghost MySQL Synology NAS Set up 1

  • STEP 5

Go to Control Panel / Security / Advanced tab/ Check Enable HTTP Compression then click Apply. Follow the instructions in the image below.

Ghost MySQL Synology NAS Set up 2

  • STEP 6

Go to Control Panel / Login Portal / Advanced Tab / click Reverse Proxy. Follow the instructions in the image below.

Ghost MySQL Synology NAS Set up 3

  • STEP 7

Now click the “Create” button. Follow the instructions in the image below.

Ghost MySQL Synology NAS Set up 4

  • STEP 8

After you click the Create button, the window below will open. Follow the instructions in the image below.

On the General area, set the Reverse Proxy Name description: type in Ghost. After that, add the following instructions:

Source:
Protocol: HTTPS
Hostname: ghost.yourname.synology.me
Port: 443

Destination:
Protocol: HTTP
Hostname: localhost
Port: 2368

Ghost MySQL Synology NAS Set up 5

  • STEP 9

On the Reverse Proxy Rules click the Custom Header tab. Click Create and then, from the drop-down menu, click WebSocket. After you click on WebSocket, two Header Names and two Values will be automatically added. Click Save. Follow the instructions in the image below.

Ghost MySQL Synology NAS Set up 6

  • STEP 10

Go to File Station and open the docker folder. Inside the docker folder, create two new folders and name one ghost and the other one ghostdb. Follow the instructions in the image below.
Note: Be careful to enter only lowercase, not uppercase letters.

Ghost MySQL Synology NAS Set up 7

  • STEP 11

Log into Portainer using your username and password. On the left sidebar in Portainer, click on Stacks then + Add stack. Follow the instructions in the image below.

1 Synology Portainer Add Stack

  • STEP 12

In the Name field type in ghost. Follow the instructions in the image below.

Note: Copy Paste the code below in the Portainer Stacks Web editor.

version: '3.8'

services:
  ghost:
    image: ghost
    container_name: Ghost
    restart: always
    depends_on:
      - db
    ports:
      - 2368:2368
    environment:
      database__client: mysql
      database__connection__host: db
      database__connection__user: marius
      database__connection__password: mariushosting
      database__connection__database: ghostdb
      url: https://ghost.yourname.synology.me
      NODE_ENV: production
    volumes:
      - /volume1/docker/ghost:/var/lib/ghost/content

  db:
    image: mysql
    container_name: Ghost-DB
    command: mysqld --default-authentication-plugin=mysql_native_password
    restart: always
    ports:
      - 3340:3306
    environment:
      MYSQL_ROOT_PASSWORD: mariushosting
      MYSQL_DATABASE: ghostdb
      MYSQL_USER: marius
      MYSQL_PASSWORD: mariushosting
    volumes:
      - /volume1/docker/ghostdb:/var/lib/mysql

Note: Before you paste the code above in the Web editor area below, change the value for database__connection__user and add your own user. marius is an example of a user. You have to insert your own user. 1*
Note: Before you paste the code above in the Web editor area below, change the value for database__connection__password and add your own password. mariushosting is an example of a password; you have to add your own password. 2*
Note: Before you paste the code above in the Web editor area below, change the value for url and add your own synology.me DDNS address https://ghost.yourname.synology.me
Note: Before you paste the code above in the Web editor area below, change the value for MYSQL_ROOT_PASSWORD and add your own root password. mariushosting is an example of a root password; you have to add your own root password. 2*
Note: Before you paste the code above in the Web editor area below, change the value for MYSQL_USER and add your own mysql user. marius is an example of a mysql user. You have to insert your own mysql user. 1*
Note: Before you paste the code above in the Web editor area below, change the value for MYSQL_PASSWORD and add your own mysql password. mariushosting is an example of a mysql password; you have to add your own mysql password. 2*
Note: 1* must be the same user. 2* must be the same password.

1 Ghost Synology NAS Set up

  • STEP 13

Scroll down on the page until you see a button named Deploy the stack. Click on it. Follow the instructions in the image below. The installation process can take up to a few minutes. It will depend on your Internet speed connection.

2 Ghost Synology NAS Set up

  • STEP 14

If everything goes right, you will see the following message at the top right of your screen: “Success Stack successfully deployed“.

3 Ghost Synology NAS Set up

  • STEP 15

Go back to STEP 1 or you will deal with karma 🙂.

  • STEP 16

Please wait approximately 5 minutes for the installation to be completed or you will get a Synology blank page if you try to connect too soon. Now open your browser and type in https://ghost.yourname.synology.me/ghost In my case https://ghost.mariushosting.synology.me/ghost If everything goes right, you will see the Ghost installation page. Note: Don’t forget to add /ghost at the end of your DDNS to access your dashboard. Add your own Site title, your Full name, your Email address and choose a strong password. Click Create account & start publishing. Follow the instructions in the image below.

Ghost MySQL Synology NAS Set up 12

  • STEP 17

Start to customize your new ghost website. Click Customize your site. Follow the instructions in the image below.

Ghost MySQL Synology NAS Set up 13

  • STEP 18

Add your own logo, site description, icon and cover then click Save at the top right of the page. Follow the instructions in the image below.

Ghost MySQL Synology NAS Set up 14

Enjoy Ghost!

Ghost MySQL Synology NAS Set up 15

Note: Your live website will be at https://ghost.yourname.synology.me and your administrator dashboard will be at https://ghost.yourname.synology.me/ghost
Note: Can I run Docker on my Synology NAS? See the supported models.
Note: Find out how to update the Ghost container with the latest image.
Note: How to Free Disk Space on Your NAS if You Run Docker.
Note: You can also use your own domain name, but in this case there are some additional STEPS needed, so it’s better to contact me.
Note: How to Schedule Start & Stop For Docker Containers.
Note: How to Activate Email Notifications.
Note: How to Add Access Control Profile on Your NAS.
Note: How to Change Docker Containers Restart Policy.
Note: How to Use Docker Containers With VPN.
Note: Convert Docker Run Into Docker Compose.
Note: How to Clean Docker.
Note: How to Clean Docker Automatically.
Note: Best Practices When Using Docker and DDNS.
Note: Some Docker Containers Need WebSocket.

This post was updated on Saturday / September 24th, 2022 at 2:03 AM