# Ghost Blog

> Modern publishing platform for blogs and newsletters.

- Category: CMS & Blogging
- Difficulty: beginner
- Components: ghost, mysql
- Tags: ghost, blog, publishing, newsletter
- Source: https://docker.recipes/cms/ghost-blog

## Overview

Ghost is a modern, open-source publishing platform designed specifically for creators, bloggers, and businesses who want professional publishing capabilities without WordPress complexity. Born from a Kickstarter campaign in 2013, Ghost focuses exclusively on content creation, offering a clean writing experience with built-in membership systems, newsletter functionality, and monetization tools. Unlike traditional CMS platforms that try to do everything, Ghost excels at one thing: helping creators build sustainable publishing businesses.

This Ghost and MySQL stack creates a powerful publishing environment where Ghost handles content creation, membership management, and newsletter distribution while MySQL provides reliable, high-performance data storage. MySQL's proven track record with content management systems makes it ideal for Ghost's post storage, member databases, and subscription tracking. The combination offers professional publishing features typically found in expensive SaaS platforms while maintaining complete control over your content and subscriber data.

Content creators, newsletter publishers, membership site operators, and businesses building thought leadership platforms will find this stack particularly valuable. Ghost's built-in Stripe integration enables immediate monetization through paid memberships, while its headless API allows custom front-end development. This setup provides the perfect balance between powerful publishing features and technical flexibility, making it suitable for everything from personal blogs to enterprise content marketing platforms.

## Features

- Built-in membership system with subscription tiers and payment processing via Stripe
- Native email newsletter functionality with subscriber management and analytics
- SEO-optimized publishing with automatic meta tags, structured data, and sitemap generation
- Modern Ghost Editor with Markdown support and rich media embedding
- Content API for headless CMS functionality and custom front-end development
- MySQL 8.0 InnoDB storage with ACID compliance for data integrity
- Professional theme system with customizable designs and responsive layouts
- Advanced analytics and member engagement tracking

## Use cases

- Professional bloggers monetizing content through paid memberships and newsletters
- Small businesses building thought leadership and customer engagement platforms
- Newsletter publishers migrating from services like Substack or ConvertKit for more control
- Content creators needing both public blog and private member-only content areas
- Marketing teams managing company blogs with multiple authors and editorial workflows
- Developers building custom publishing platforms using Ghost's Content API
- Membership sites offering premium content and community features

## Prerequisites

- Minimum 1GB RAM recommended for Ghost and MySQL combined operation
- Docker and Docker Compose installed with support for multi-container networking
- Port 2368 available for Ghost web interface access
- Valid domain name and SSL certificate for production newsletter and membership features
- SMTP service configured for Ghost email functionality (newsletters, member invitations)
- Basic understanding of Ghost admin interface and MySQL database concepts

## docker-compose.yml

```yaml
services:
  ghost:
    image: ghost:5-alpine
    container_name: ghost
    restart: unless-stopped
    environment:
      url: ${GHOST_URL}
      database__client: mysql
      database__connection__host: mysql
      database__connection__user: ${MYSQL_USER}
      database__connection__password: ${MYSQL_PASSWORD}
      database__connection__database: ${MYSQL_DATABASE}
    volumes:
      - ghost_content:/var/lib/ghost/content
    ports:
      - "2368:2368"
    depends_on:
      - mysql
    networks:
      - ghost-network

  mysql:
    image: mysql:8.0
    container_name: ghost-mysql
    environment:
      MYSQL_ROOT_PASSWORD: ${MYSQL_ROOT_PASSWORD}
      MYSQL_DATABASE: ${MYSQL_DATABASE}
      MYSQL_USER: ${MYSQL_USER}
      MYSQL_PASSWORD: ${MYSQL_PASSWORD}
    volumes:
      - mysql_data:/var/lib/mysql
    networks:
      - ghost-network

volumes:
  ghost_content:
  mysql_data:

networks:
  ghost-network:
    driver: bridge
```

## .env

```bash
GHOST_URL=http://localhost:2368
MYSQL_ROOT_PASSWORD=rootpassword
MYSQL_DATABASE=ghost
MYSQL_USER=ghost
MYSQL_PASSWORD=changeme
```

## Usage notes

- Docs: https://ghost.org/docs/
- Access at http://localhost:2368, admin at http://localhost:2368/ghost
- Set GHOST_URL to your domain for production links
- Built-in newsletter, membership, and Stripe payments
- Themes in /var/lib/ghost/content/themes
- Ghost(Pro) alternative with self-hosted control

## Troubleshooting

- Ghost shows database connection errors: Verify MYSQL_USER and MYSQL_PASSWORD environment variables match between services and that MySQL container is fully initialized before Ghost starts
- Newsletter emails not sending: Configure proper SMTP settings in Ghost admin panel under Settings > Labs > Email, as Ghost requires external SMTP service for email delivery
- Ghost admin redirects to wrong URL: Set GHOST_URL environment variable to match your actual domain, including protocol (http/https) and port if non-standard
- Membership signup failures: Ensure GHOST_URL is set correctly and Stripe webhooks are configured if using paid memberships, as Ghost validates URLs during payment processing
- MySQL container fails to start with permission errors: Check that the mysql_data volume has proper permissions and isn't conflicting with existing MySQL installations on the host

