Ghost ist eine moderne Open-Source-Publishing-Plattform. Sie ist schnell, minimalistisch und auf professionelles Blogging ausgerichtet.
Warum Ghost?
Vorteile
- Schnell und performant (Node.js)
- Modernes, cleanes Interface
- SEO-optimiert
- Membership-Funktionen
- Newsletter integriert
- REST API + GraphQL
- Markdown-Editor
- Themes anpassbarGhost vs WordPress
| Feature | Ghost | WordPress | |---------|-------|-----------| | Basis | Node.js | PHP | | Fokus | Publishing | Allgemein | | Performance | Sehr schnell | Mittel | | Plugins | Begrenzt | Tausende | | Lernkurve | Flach | Mittel | | Membership | Integriert | Plugin |
Voraussetzungen
Systemanforderungen
- Ubuntu 20.04/22.04 oder Debian 11/12
- Node.js 18.x LTS
- MySQL 8 oder MariaDB 10.5+
- Nginx
- 1 GB RAM (2 GB empfohlen)
- SSL-ZertifikatInstallation
Node.js installieren
curl -fsSL https://deb.nodesource.com/setup_18.x | bash -
apt install nodejs
node --versionMySQL/MariaDB
apt install mariadb-server
mysql_secure_installationCREATE DATABASE ghost_production CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;
CREATE USER 'ghost'@'localhost' IDENTIFIED BY 'sicheres_passwort';
GRANT ALL ON ghost_production.* TO 'ghost'@'localhost';
FLUSH PRIVILEGES;Nginx
apt install nginxGhost-CLI installieren
npm install ghost-cli@latest -gGhost-Benutzer erstellen
adduser --disabled-password --gecos "" ghost
usermod -aG sudo ghostGhost installieren
# Verzeichnis erstellen
mkdir -p /var/www/ghost
chown ghost:ghost /var/www/ghost
chmod 775 /var/www/ghost
# Als Ghost-User
su - ghost
cd /var/www/ghost
# Installation
ghost installInstallations-Dialog
? Enter your blog URL: https://blog.example.de
? Enter your MySQL hostname: localhost
? Enter your MySQL username: ghost
? Enter your MySQL password: sicheres_passwort
? Enter your Ghost database name: ghost_production
? Do you wish to set up Nginx? Yes
? Do you wish to set up SSL? Yes
? Enter your email (For SSL Certificate): admin@example.de
? Do you wish to set up systemd? Yes
? Do you want to start Ghost? YesKonfiguration
config.production.json
{
"url": "https://blog.example.de",
"server": {
"port": 2368,
"host": "127.0.0.1"
},
"database": {
"client": "mysql",
"connection": {
"host": "localhost",
"user": "ghost",
"password": "sicheres_passwort",
"database": "ghost_production"
}
},
"mail": {
"transport": "SMTP",
"options": {
"host": "smtp.example.de",
"port": 587,
"secure": false,
"auth": {
"user": "noreply@example.de",
"pass": "mail_passwort"
}
}
},
"logging": {
"transports": ["file", "stdout"]
},
"process": "systemd",
"paths": {
"contentPath": "/var/www/ghost/content"
}
}Mail-Konfiguration
{
"mail": {
"transport": "SMTP",
"from": "'Blog' <noreply@example.de>",
"options": {
"host": "smtp.mailgun.org",
"port": 587,
"auth": {
"user": "postmaster@mg.example.de",
"pass": "api_key"
}
}
}
}Nginx-Konfiguration
Standard (von Ghost erstellt)
# /etc/nginx/sites-available/ghost_blog-example-de.conf
server {
listen 80;
listen [::]:80;
server_name blog.example.de;
return 301 https://$host$request_uri;
}
server {
listen 443 ssl http2;
listen [::]:443 ssl http2;
server_name blog.example.de;
ssl_certificate /etc/letsencrypt/live/blog.example.de/fullchain.pem;
ssl_certificate_key /etc/letsencrypt/live/blog.example.de/privkey.pem;
include /etc/letsencrypt/options-ssl-nginx.conf;
location / {
proxy_pass http://127.0.0.1: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;
proxy_buffering off;
}
client_max_body_size 50m;
}Mit Caching
server {
# ... SSL config ...
location ~* \.(js|css|png|jpg|jpeg|gif|ico|svg|woff|woff2)$ {
proxy_pass http://127.0.0.1:2368;
proxy_set_header Host $host;
expires 1y;
add_header Cache-Control "public, immutable";
}
location / {
proxy_pass http://127.0.0.1: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;
}
}Ghost-CLI Befehle
Verwaltung
# Als Ghost-User, im Ghost-Verzeichnis
cd /var/www/ghost
# Status
ghost status
# Starten
ghost start
# Stoppen
ghost stop
# Neustarten
ghost restart
# Logs anzeigen
ghost log
# Konfiguration bearbeiten
ghost configUpdates
# Backup erstellen
ghost backup
# Update durchführen
ghost update
# Auf bestimmte Version
ghost update --v5.80.0Admin-Bereich
Zugriff
https://blog.example.de/ghostErster Benutzer
1. URL aufrufen
2. Account erstellen
3. Blog-Titel setzen
4. Team einladen (optional)Themes
Standard-Themes
- Casper (Standard)
- Source
- Edition
- LondonTheme installieren
# Theme herunterladen
cd /var/www/ghost/content/themes
unzip theme-name.zip
# Ghost neustarten
ghost restartTheme aktivieren
Admin → Settings → Design → Change themeEigenes Theme entwickeln
content/themes/mein-theme/
├── assets/
│ ├── css/
│ └── js/
├── partials/
│ ├── header.hbs
│ └── footer.hbs
├── default.hbs
├── index.hbs
├── post.hbs
├── page.hbs
├── tag.hbs
├── author.hbs
└── package.jsonMembership & Subscriptions
Aktivieren
Admin → Settings → Membership → Enable free signupStripe-Integration
Admin → Settings → Membership → Connect to StripeKonfiguration
{
"portal": {
"name": "Newsletter",
"plans": ["free", "monthly", "yearly"],
"monthlyPrice": 5,
"yearlyPrice": 50,
"currency": "EUR"
}
}Integrations
Built-in
- Unsplash (Bilder)
- Slack
- AMP
- FirstPromoterZapier
Admin → Settings → Integrations → ZapierCustom Integration
Admin → Settings → Integrations → Add custom integration
# API Keys erhalten:
# - Content API Key
# - Admin API KeyAPI-Nutzung
Content API
# Posts abrufen
curl "https://blog.example.de/ghost/api/content/posts/?key=API_KEY"Admin API
const GhostAdminAPI = require('@tryghost/admin-api');
const api = new GhostAdminAPI({
url: 'https://blog.example.de',
key: 'ADMIN_API_KEY',
version: 'v5.0'
});
// Post erstellen
api.posts.add({
title: 'Neuer Post',
html: '<p>Inhalt</p>',
status: 'published'
});Backup
Mit Ghost-CLI
ghost backup
# Erstellt: /var/www/ghost/content/data/ghost-backup-*.zipManuell
#!/bin/bash
# /usr/local/bin/ghost-backup.sh
BACKUP_DIR=/backup/ghost
DATE=$(date +%Y-%m-%d)
mkdir -p $BACKUP_DIR
# Datenbank
mysqldump -u ghost -p ghost_production > $BACKUP_DIR/db-$DATE.sql
# Content-Verzeichnis
tar -czf $BACKUP_DIR/content-$DATE.tar.gz /var/www/ghost/content
# Alte Backups löschen (älter als 30 Tage)
find $BACKUP_DIR -name "*.sql" -mtime +30 -delete
find $BACKUP_DIR -name "*.tar.gz" -mtime +30 -deleteDocker
Docker Compose
version: '3'
services:
ghost:
image: ghost:5-alpine
restart: always
ports:
- 2368:2368
environment:
url: https://blog.example.de
database__client: mysql
database__connection__host: db
database__connection__user: ghost
database__connection__password: password
database__connection__database: ghost
volumes:
- ghost_content:/var/lib/ghost/content
depends_on:
- db
db:
image: mariadb:10
restart: always
environment:
MYSQL_ROOT_PASSWORD: rootpassword
MYSQL_DATABASE: ghost
MYSQL_USER: ghost
MYSQL_PASSWORD: password
volumes:
- ghost_db:/var/lib/mysql
volumes:
ghost_content:
ghost_db:Troubleshooting
Ghost startet nicht
# Logs prüfen
ghost log
# Node-Version prüfen
node --version # Muss 18.x sein
# Berechtigungen
chown -R ghost:ghost /var/www/ghostDatenbank-Fehler
# Verbindung testen
mysql -u ghost -p ghost_production -e "SELECT 1"
# Migrationen ausführen
ghost run knex-migrator migrateSSL-Probleme
# Zertifikat erneuern
ghost setup ssl
# Oder
certbot renewZusammenfassung
| Befehl | Funktion | |--------|----------| | ghost install | Installation | | ghost start/stop | Dienst steuern | | ghost update | Aktualisieren | | ghost backup | Backup erstellen | | ghost log | Logs anzeigen | | ghost config | Konfiguration |
| Verzeichnis | Inhalt | |-------------|--------| | /var/www/ghost | Installation | | content/themes | Themes | | content/images | Uploads | | content/data | Backups |
| Port | Dienst | |------|--------| | 2368 | Ghost | | 80/443 | Nginx |
Fazit
Ghost ist die ideale Plattform für professionelles Publishing. Die Performance ist dank Node.js ausgezeichnet. Der Editor ist modern und intuitiv. Membership-Funktionen ermöglichen Monetarisierung ohne Plugins. Die API erlaubt headless CMS-Nutzung. Für Blogs, Magazine und Newsletter-Plattformen ist Ghost eine ausgezeichnete Wahl.