Back to articles
DevOps & Systems

Self-Host Ghost CMS on Docker: Optimized SEO Blog & Professional Email Newsletter Platform

This guide provides a detailed walkthrough for self-hosting Ghost CMS on Docker with SEO optimization and professional email newsletter integration. It covers setup, configuration,...

DPTCloud Engineering4 min read
Self-Host Ghost CMS on Docker: Optimized SEO Blog & Professional Email Newsletter Platform

This guide provides a detailed walkthrough for self-hosting Ghost CMS on Docker with SEO optimization and professional email newsletter integration. It covers setup, configuration, SMTP integration, and security best practices for a robust, containerized blogging platform.

Requirements and Preparation

To self-host Ghost CMS on Docker, you need:

Installing Ghost CMS on Docker

Use Docker Compose to deploy Ghost CMS. Create a new directory and a docker-compose.yml file:

version: '3.8'

services:
  ghost:
    image: ghost:5
    container_name: ghost-blog
    restart: unless-stopped
    ports:
      - "2368:2368"
    environment:
      url: https://yourdomain.com
      database__client: mysql
      database__connection__host: mysql
      database__connection__user: ghost
      database__connection__password: ghost
      database__connection__database: ghost
      mail__transport: SMTP
      mail__options__host: smtp.your-email-provider.com
      mail__options__port: 587
      mail__options__secure: true
      mail__options__auth__user: [email protected]
      mail__options__auth__pass: your-email-password
    volumes:
      - ./ghost/content:/var/lib/ghost/content
    depends_on:
      - mysql

  mysql:
    image: mysql:8.0
    container_name: ghost-mysql
    restart: unless-stopped
    environment:
      MYSQL_ROOT_PASSWORD: rootpassword
      MYSQL_DATABASE: ghost
      MYSQL_USER: ghost
      MYSQL_PASSWORD: ghost
    volumes:
      - ./mysql/data:/var/lib/mysql
    command:
      --default-authentication-plugin=mysql_native_password

Replace the placeholders with your details:

  • yourdomain.com: Your domain.
  • smtp.your-email-provider.com: SMTP server (e.g., smtp.gmail.com).
  • [email protected] and your-email-password: SMTP credentials.

Start the stack:

docker-compose up -d

SEO Optimization and Email Newsletter Integration

Ghost CMS is built for SEO with features like:

  • Auto-generated page titles and descriptions from post titles.
  • SEO-friendly clean URLs.
  • Open Graph and JSON-LD integration for enhanced search visibility.
  • Automated social sharing.

To send professional email newsletters:

  1. Log in to Ghost Admin at https://yourdomain.com/ghost.
  2. Navigate to Settings → Integrations.
  3. Add an email service (e.g., SendGrid, Mailgun, or custom SMTP).
  4. Integrate and verify the service.
  5. Create and send newsletters from Members → Emails.

For deeper insights, consider plugins like Ghost SEO or Ghost Analytics (see Building a Privacy-First Static Site Analytics System from a VPS Host with Umami and ClickHouse) to track SEO performance and user behavior.

Running Ghost Behind Nginx with SSL

Secure and optimize performance by proxying Ghost through Nginx with SSL. Create an Nginx configuration:

server {
    listen 80;
    server_name yourdomain.com;
    return 301 https://$server_name$request_uri;
}

server {
    listen 443 ssl;
    server_name yourdomain.com;

    ssl_certificate /etc/letsencrypt/live/yourdomain.com/fullchain.pem;
    ssl_certificate_key /etc/letsencrypt/live/yourdomain.com/privkey.pem;

    location / {
        proxy_pass http://localhost:2368;
        proxy_set_header Host $host;
        proxy_set_header X-Real-IP $remote_addr;
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
        proxy_set_header X-Forwarded-Proto $scheme;
    }
}

Obtain SSL using Let's Encrypt:

sudo certbot certonly --nginx -d yourdomain.com

Troubleshooting and Verification

Check the status:

docker-compose ps
docker-compose logs ghost

If Ghost fails to start, verify:

  • Volume paths are correct.
  • MySQL connection details are accurate.
  • SMTP credentials are valid.

For SSL issues, ensure the domain is verified and Nginx is configured properly.

References

Successfully self-hosting Ghost CMS on Docker enables a professional, SEO-optimized blog with powerful email newsletter capabilities.

DPTCloud Tier III Infrastructure

Recommended NVMe Cloud VPS Plans to Deploy This Setup

Enterprise RAID 10 NVMe SSDs, CMC & FPT District 9 uplinks with Anycast Anti-DDoS and 99.99% SLA.

View 22 VPS Plans
ECO · vn-02

VPS-2E

94.600 ₫ / mo

10% VAT included

  • CPU: 2 vCPU
  • RAM: 2 GB
  • SSD: 30 GB NVMe
ECO · vn-02Recommended

VPS-3E

170.500 ₫ / mo

10% VAT included

  • CPU: 2 vCPU
  • RAM: 4 GB
  • SSD: 50 GB NVMe
BASIC · vn-01Recommended

VPS-05

457.600 ₫ / mo

10% VAT included

  • CPU: 4 vCPU
  • RAM: 8 GB
  • SSD: 50 GB NVMe

Related Articles

View all
ZaloZalo SupportDiscord0384 753 478