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,...
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:
- A VPS or Dedicated Server (see NVMe Cloud VPS for Docker, Nginx & Databases or High-Performance Dedicated Servers for Production Clusters)
- Docker and Docker Compose installed
- A domain name and SSL certificate (use Let's Encrypt)
- An SMTP email service (e.g., Gmail, SendGrid, or custom)
- Minimum resources: 2GB RAM, 1 CPU, 20GB SSD
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]andyour-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:
- Log in to Ghost Admin at
https://yourdomain.com/ghost. - Navigate to Settings → Integrations.
- Add an email service (e.g., SendGrid, Mailgun, or custom SMTP).
- Integrate and verify the service.
- 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
- Ghost CMS Official Documentation
- Docker Compose Documentation
- Nginx Documentation
- Let's Encrypt Documentation
Successfully self-hosting Ghost CMS on Docker enables a professional, SEO-optimized blog with powerful email newsletter capabilities.
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.
VPS-3E
10% VAT included
- CPU: 2 vCPU
- RAM: 4 GB
- SSD: 50 GB NVMe
