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.82.3 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 / Login Portal / Advanced Tab / click Reverse Proxy. Follow the instructions in the image below.

Ghost Synology NAS Set up 1 new 2023

  • STEP 5

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

Ghost Synology NAS Set up 2 new 2023

  • STEP 6

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

Check Enable HSTS

Destination:
Protocol: HTTP
Hostname: localhost
Port: 2368

Ghost Synology NAS Set up 3 new 2023

  • STEP 7

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.

Synology Proxy WebSocket

  • STEP 8

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

Ghost Synology NAS Set up 4 new 2023

  • STEP 9

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

Ghost Synology NAS Set up 5 new 2023

  • STEP 10

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

Ghost Synology NAS Set up 6 new 2023

  • STEP 11

Now create one new folder inside the ghost folder that you created at STEP 10 and it db. Follow the instructions in the image below.
Note: Be careful to enter only lowercase, not uppercase letters.

Ghost Synology NAS Set up 7 new 2023

  • STEP 12

Follow my step by step guide on how to activate SMTP for your Gmail account. This step is mandatory. Note: If you don’t want to use the easiest way for SMTP with Google and you already have SMTP details from your own Mail Server, you can just skip this STEP and use your personalized email SMTP details instead.

  • STEP 13

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 14

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.9'
services:
  ghost-db:
    image: mysql
    container_name: Ghost-DB
    hostname: ghost-db
    security_opt:
      - no-new-privileges:true
    healthcheck:
     test: ["CMD", "mysqladmin" ,"ping", "-h", "localhost"]
    environment:
      - PUID=1026
      - PGID=100
      - TZ=Europe/Bucharest
      - MYSQL_ROOT_PASSWORD=superpassword
      - MYSQL_DATABASE=ghost
      - MYSQL_USER=ghostuser
      - MYSQL_PASSWORD=ghostpass
    volumes:
      - /volume1/docker/ghost/db:/var/lib/mysql:rw
    restart: on-failure:5

  ghost:
    image: ghost:latest
    container_name: Ghost
    healthcheck:
      test: timeout 10s bash -c ':> /dev/tcp/127.0.0.1/2368' || exit 1
      interval: 10s
      timeout: 5s
      retries: 3
      start_period: 90s
    hostname: ghost
    security_opt:
      - no-new-privileges:true
    user: 1026:100 
    environment:
      database__client: mysql
      database__connection__host: ghost-db
      database__connection__user: ghostuser
      database__connection__password: ghostpass
      database__connection__database: ghost
      url: https://ghost.yourname.synology.me
      mail__transport: SMTP
      mail__options__service: SMTP
      mail__from: Your-own-gmail-address
      mail__options__host: smtp.gmail.com
      mail__options__port: 587
      mail__options__auth__user: Your-own-gmail-address
      mail__options__auth__pass: Your-own-app-password
      NODE_ENV: production
    volumes:
      - /volume1/docker/ghost:/var/lib/ghost/content:rw
    ports:
      - 2368:2368
    restart: on-failure:5
    depends_on:
      ghost-db:
        condition: service_healthy

Note: Before you paste the code above in the Web editor area below, change the value numbers for PUID and PGID with your own values. (Follow my step by step guide on how to do this.)
Note: Before you paste the code above in the Web editor area below, change the value for TZ. (Select your current Time Zone from this list.)
Note: Before you paste the code above in the Web editor area below, change the value numbers for user with your own UID and GID values. (Follow my step by step guide on how to do this.1026 is my personal UID value and 100 is my personal GID value. You have to type in your own values.
Note: Before you paste the code above in the Web editor area below, change the value for url and type in your own synology.me DDNS with https:// at the beginning that you have previously created at STEP 6.
Note: Before you paste the code above in the Web editor area below, change the value for mail__from and type in your own Gmail address. Refer to STEP 12.
Note: Before you paste the code above in the Web editor area below, change the value for mail__options__auth__user and type in your own Gmail address. Refer to STEP 12.
Note: Before you paste the code above in the Web editor area below, change the value for mail__options__auth__pass and type in your own Gmail app password. Refer to STEP 12.

Ghost Synology NAS Set up 8 new 2025

  • STEP 15

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.

Ghost Synology NAS Set up 9 new 2025

  • STEP 16

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

Ghost Synology NAS Set up 10 new 2023

  • STEP 17

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

  • STEP 18

Please wait approximately 5 minutes for the installation to be completed. If you try to connect too soon, you will get an error page that says: We’ll be right back. We’re busy updating our site to give you the best experience, and will be back 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 19

After the registration, you will get an email message. Check your Email. Follow the instructions in the image below.

Ghost Synology NAS Set up 11 new 2023

  • STEP 20

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 21

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: How to Back Up Docker Containers on your Synology NAS.
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.
Note: Find out the Best NAS Models For Docker.
Note: Activate Gmail SMTP For Docker Containers.

This post was updated on Sunday / April 21st, 2024 at 1:42 PM