Ghost CMS
A self-hosted Ghost CMS stack for professional publishing, backed by MySQL 8.0 for content storage and fronted by Nginx as a reverse proxy. Ghost 5 provides a modern editor, membership and subscription management, newsletter delivery, and a customizable theme engine out of the box. Nginx handles SSL termination, static asset caching, and request proxying to the Ghost Node.js application on the internal network. MySQL is tuned with InnoDB optimizations and health checks ensure correct startup ordering across all services. Ghost content (images, themes, and settings) is persisted in a named volume, making backups and migrations straightforward.
Servizi Inclusi
nginx
nginx:1.27-alpine
ghost
ghost:5-alpine
Variabili d'Ambiente:
mysql
mysql:8.0
Variabili d'Ambiente:
YAML Generato
# Generated by ComposeHub (composehub.dev)
name: ghost-mysql
services:
nginx:
image: nginx:1.27-alpine
restart: unless-stopped
ports:
- 80:80
- 443:443
volumes:
- nginx_conf:/etc/nginx/conf.d
networks:
- frontend
- backend
depends_on:
ghost:
condition: service_healthy
healthcheck:
test:
- CMD-SHELL
- curl -f http://localhost/ || exit 1
interval: 30s
timeout: 10s
retries: 3
start_period: 10s
deploy:
resources:
limits:
cpus: "0.50"
memory: 256M
reservations:
cpus: "0.10"
memory: 64M
labels:
com.composeforge.description: Nginx reverse proxy for Ghost CMS
ghost:
image: ghost:5-alpine
restart: unless-stopped
expose:
- "2368"
volumes:
- ghost_content:/var/lib/ghost/content
environment:
url: ${GHOST_URL:-http://localhost}
database__client: mysql
database__connection__host: mysql
database__connection__port: "3306"
database__connection__user: ${MYSQL_USER:-ghost}
database__connection__password: ${MYSQL_PASSWORD:-changeme}
database__connection__database: ${MYSQL_DATABASE:-ghost}
mail__transport: ${GHOST_MAIL_TRANSPORT:-Direct}
mail__from: ${GHOST_MAIL_FROM:[email protected]}
mail__options__host: ${GHOST_SMTP_HOST:-}
mail__options__port: ${GHOST_SMTP_PORT:-587}
mail__options__auth__user: ${GHOST_SMTP_USER:-}
mail__options__auth__pass: ${GHOST_SMTP_PASSWORD:-}
NODE_ENV: production
networks:
- backend
depends_on:
mysql:
condition: service_healthy
healthcheck:
test:
- CMD-SHELL
- wget --no-verbose --tries=1 --spider http://localhost:2368/ghost/api/admin/site/ || exit 1
interval: 30s
timeout: 10s
retries: 5
start_period: 30s
deploy:
resources:
limits:
cpus: "1.00"
memory: 512M
reservations:
cpus: "0.25"
memory: 128M
labels:
com.composeforge.description: Ghost 5 CMS Node.js application
mysql:
image: mysql:8.0
restart: unless-stopped
command:
- "--default-authentication-plugin=caching_sha2_password"
- "--innodb-buffer-pool-size=256M"
- "--innodb-log-file-size=64M"
- "--innodb-flush-method=O_DIRECT"
- "--character-set-server=utf8mb4"
- "--collation-server=utf8mb4_unicode_ci"
- "--max-connections=100"
volumes:
- mysql_data:/var/lib/mysql
environment:
MYSQL_ROOT_PASSWORD: ${MYSQL_ROOT_PASSWORD:-rootchangeme}
MYSQL_DATABASE: ${MYSQL_DATABASE:-ghost}
MYSQL_USER: ${MYSQL_USER:-ghost}
MYSQL_PASSWORD: ${MYSQL_PASSWORD:-changeme}
networks:
- backend
healthcheck:
test:
- CMD
- mysqladmin
- ping
- "-h"
- localhost
- "-u"
- root
- "-p${MYSQL_ROOT_PASSWORD:-rootchangeme}"
interval: 15s
timeout: 5s
retries: 5
start_period: 60s
deploy:
resources:
limits:
cpus: "1.00"
memory: 512M
reservations:
cpus: "0.25"
memory: 256M
labels:
com.composeforge.description: MySQL 8.0 database for Ghost CMS
networks:
frontend:
driver: bridge
backend:
driver: bridge
volumes:
ghost_content:
driver: local
mysql_data:
driver: local
nginx_conf:
driver: local
Informazioni Rapide
- Servizi
- 3
- Reti
- 2
- Volumi
- 3
Quando Usarlo
Questo template è ideale per configurare un ambiente ghost cms Tutti i servizi sono preconfigurati con healthchecks, limiti di risorse e valori predefiniti sensati. Personalizza le variabili d'ambiente prima di fare il deploy in produzione.
Consigli
- Cambia tutte le password predefinite prima del deploy
- Verifica i limiti di risorse per il tuo hardware
- Aggiungi un reverse proxy per HTTPS in produzione
- Configura strategie di backup per i volumi di dati