Ana içeriğe geç
Kategoriye Dön

Ghost Kurulumu: Self-Hosted Blog ve İçerik Platformu

Ghost Docker kurulumu, Nginx reverse proxy, SSL sertifikası, tema kurulumu, üyelik ve abonelik sistemi, email newsletter ve production yapılandırması.

Okuma süresi: 13 dk Self-Hosting
ghostblogcmsself-hostingdockernewsletteriçerik yönetimi

İçindekiler

Ghost Kurulumu: Self-Hosted Blog ve İçerik Platformu

Ghost, modern blog ve içerik yayıncılığı için tasarlanmış açık kaynaklı bir CMS platformudur. WordPress'e kıyasla daha hızlı, daha güvenli ve içerik odaklı bir yapıya sahiptir. Üyelik sistemi, newsletter ve ödeme entegrasyonu ile içerik monetizasyonu da destekler.

Ghost Nedir?

Ghost, Node.js tabanlı headless CMS ve yayıncılık platformudur. Öne çıkan özellikleri:

  • Hız: Node.js tabanlı, çok hızlı sayfa yükleme
  • SEO: Yerleşik SEO araçları ve yapılandırılmış veri
  • Üyelik: Ücretsiz ve ücretli üyelik sistemi
  • Newsletter: Dahili e-posta bülteni gönderimi
  • Temalar: Handlebars tabanlı tema sistemi
  • API: Headless CMS olarak kullanım için REST API

Sistem Gereksinimleri

  • Docker ve Docker Compose kurulu sunucu
  • Minimum 1 GB RAM (2 GB önerilir)
  • MySQL 8.0 veya SQLite
  • Geçerli domain ve SSL sertifikası

Docker ile Kurulum

MySQL ile Production Kurulum

hljs yaml
# docker-compose.yml
version: '3.8'

services:
  ghost:
    image: ghost:5-alpine
    container_name: ghost
    restart: unless-stopped
    depends_on:
      - db
    environment:
      database__client: mysql
      database__connection__host: db
      database__connection__user: ghost
      database__connection__password: guclu-sifre
      database__connection__database: ghost
      url: https://blog.example.com
      mail__transport: SMTP
      mail__options__host: smtp.mailgun.org
      mail__options__port: 587
      mail__options__auth__user: postmaster@mg.example.com
      mail__options__auth__pass: mailgun-api-key
      mail__from: noreply@example.com
    volumes:
      - ./ghost-content:/var/lib/ghost/content
    ports:
      - "127.0.0.1:2368:2368"

  db:
    image: mysql:8.0
    container_name: ghost-db
    restart: unless-stopped
    environment:
      MYSQL_ROOT_PASSWORD: root-sifre
      MYSQL_DATABASE: ghost
      MYSQL_USER: ghost
      MYSQL_PASSWORD: guclu-sifre
    volumes:
      - mysql-data:/var/lib/mysql

volumes:
  mysql-data:
hljs bash
# Container'ları başlat
docker compose up -d

# Logları kontrol et
docker logs ghost -f

Ghost ilk başlatmada veritabanını otomatik oluşturur. https://blog.example.com/ghost adresinden admin paneline erişebilirsiniz.

SQLite ile Hızlı Başlangıç

hljs yaml
services:
  ghost:
    image: ghost:5-alpine
    container_name: ghost
    restart: unless-stopped
    environment:
      url: https://blog.example.com
      NODE_ENV: production
    volumes:
      - ./ghost-content:/var/lib/ghost/content
    ports:
      - "127.0.0.1:2368:2368"

Nginx Reverse Proxy ve SSL

hljs nginx
server {
    listen 80;
    server_name blog.example.com;
    return 301 https://$host$request_uri;
}

server {
    listen 443 ssl http2;
    server_name blog.example.com;

    ssl_certificate /etc/letsencrypt/live/blog.example.com/fullchain.pem;
    ssl_certificate_key /etc/letsencrypt/live/blog.example.com/privkey.pem;
    ssl_protocols TLSv1.2 TLSv1.3;

    # Güvenlik başlıkları
    add_header X-Frame-Options SAMEORIGIN;
    add_header X-Content-Type-Options nosniff;
    add_header Referrer-Policy no-referrer-when-downgrade;

    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;
    }
}
hljs bash
# SSL sertifikası al
certbot --nginx -d blog.example.com

Admin Panel Yapılandırması

https://blog.example.com/ghost adresine gidin:

  1. Admin hesabı oluşturun (ad, e-posta, şifre)
  2. Site başlığı ve açıklaması girin
  3. Tema seçin veya yükleyin
  4. Yayın ayarları yapılandırın

Genel Ayarlar

Settings → General
- Site title: Blog Adı
- Site description: Kısa açıklama
- Site timezone: Europe/Istanbul
- Publication language: tr
- Meta title/description: SEO için

Tema Kurulumu

Ücretsiz Temalar

hljs bash
# Casper (varsayılan tema)
# Zaten yüklü gelir

# Özel tema yükleme
# Settings → Design → Upload theme
# .zip formatında tema dosyası yükleyin

Tema Özelleştirme

hljs handlebars
{{! default.hbs - Ana şablon }}
<!DOCTYPE html>
<html lang="{{@site.locale}}">
<head>
    <meta charset="utf-8">
    <title>{{meta_title}}</title>
    {{ghost_head}}
</head>
<body class="{{body_class}}">
    {{> header}}
    {{{body}}}
    {{> footer}}
    {{ghost_foot}}
</body>
</html>

Üyelik ve Abonelik Sistemi

Üyelik Yapılandırması

Settings → Membership
- Allow free members: Etkin
- Paid subscriptions: Stripe ile
- Default post access: Public / Members only / Paid

Stripe Entegrasyonu

Settings → Membership → Stripe
1. Stripe hesabı oluşturun
2. API anahtarlarını girin:
   - Publishable key: pk_live_...
   - Secret key: sk_live_...
3. Webhook endpoint ekleyin:
   https://blog.example.com/members/webhooks/stripe

İçerik Erişim Kontrolü

hljs markdown
Bu bölüm herkese açık.

<!--members-only-->
Bu bölüm sadece üyelere görünür.

<!--paid-members-only-->
Bu bölüm sadece ücretli üyelere görünür.

Email Newsletter

Mailgun Yapılandırması

hljs yaml
environment:
  mail__transport: SMTP
  mail__options__service: Mailgun
  mail__options__host: smtp.mailgun.org
  mail__options__port: 587
  mail__options__auth__user: postmaster@mg.example.com
  mail__options__auth__pass: mailgun-smtp-password
  mail__from: "Blog Adı <noreply@example.com>"

Newsletter Gönderimi

Yeni yazı oluştururken:
- Email newsletter: Etkin
- Send to: All members / Free members / Paid members
- Subject: E-posta konusu
- Preview text: Önizleme metni

Ghost CLI ile Yönetim

hljs bash
# Ghost container içinde CLI kullanımı
docker exec -it ghost ghost

# Kullanıcı listesi
docker exec ghost ghost ls

# Ghost'u yeniden başlat
docker exec ghost ghost restart

# Log görüntüle
docker exec ghost ghost log

Yedekleme

hljs bash
# Ghost içerik dizinini yedekle
tar -czf ghost-backup-$(date +%Y%m%d).tar.gz ./ghost-content/

# MySQL veritabanı yedeği
docker exec ghost-db mysqldump -u ghost -pguclu-sifre ghost > \
  ghost-db-$(date +%Y%m%d).sql

# Otomatik yedekleme scripti
cat > /etc/cron.daily/ghost-backup << 'EOF'
#!/bin/bash
BACKUP_DIR="/backups/ghost"
mkdir -p $BACKUP_DIR
tar -czf $BACKUP_DIR/content-$(date +%Y%m%d).tar.gz /opt/ghost/ghost-content/
docker exec ghost-db mysqldump -u ghost -pguclu-sifre ghost | \
  gzip > $BACKUP_DIR/db-$(date +%Y%m%d).sql.gz
find $BACKUP_DIR -name "*.gz" -mtime +30 -delete
EOF
chmod +x /etc/cron.daily/ghost-backup

REXE VPS sunucularında Ghost ile profesyonel blog ve içerik platformu kurabilirsiniz. 2 GB RAM ile binlerce okuyucuya hizmet verebilirsiniz.