b2in/dev/DISPLAY_SETUP_LIVE.md
2026-01-23 17:33:10 +01:00

7.2 KiB

Display Setup für Live-Server (cabinet.b2in.eu)

Übersicht

Das Display-System nutzt den Ordner public/_cabinet/ für beide Umgebungen:

  • Testserver: portal.b2in.test/_cabinet/
  • Live-Server: cabinet.b2in.eu/ (Subdomain zeigt direkt auf public/_cabinet/)

Setup-Schritte für Live-Server

1. Dateien vorbereiten

Die Dateien sind bereits im Ordner public/_cabinet/ vorhanden:

public/_cabinet/
├── index.html      # Display-Seite
├── go.php          # Short-Link-Handler
├── assets/         # Video-Dateien
│   ├── herbst_2025.mp4
│   ├── fruehjahr_2025.mp4
│   └── ...
└── clicks.log      # Tracking-Log (wird automatisch erstellt)

2. Subdomain konfigurieren

Auf dem Live-Server die Subdomain cabinet.b2in.eu so einrichten, dass sie direkt auf /public/_cabinet/ zeigt.

Apache VirtualHost Beispiel:

<VirtualHost *:443>
    ServerName cabinet.b2in.eu
    DocumentRoot /var/www/html/public/_cabinet
    
    <Directory /var/www/html/public/_cabinet>
        Options Indexes FollowSymLinks
        AllowOverride All
        Require all granted
    </Directory>

    # SSL Konfiguration
    SSLEngine on
    SSLCertificateFile /etc/ssl/certs/certificate.crt
    SSLCertificateKeyFile /etc/ssl/private/private.key
    
    # Optionale Sicherheits-Header
    Header always set X-Frame-Options "SAMEORIGIN"
    Header always set X-Content-Type-Options "nosniff"
</VirtualHost>

Nginx Beispiel:

server {
    listen 443 ssl http2;
    server_name cabinet.b2in.eu;
    root /var/www/html/public/_cabinet;

    index index.html index.php;

    # SSL Konfiguration
    ssl_certificate /etc/ssl/certs/certificate.crt;
    ssl_certificate_key /etc/ssl/private/private.key;
    ssl_protocols TLSv1.2 TLSv1.3;
    ssl_ciphers HIGH:!aNULL:!MD5;

    location / {
        try_files $uri $uri/ /index.html;
    }

    location ~ \.php$ {
        fastcgi_pass unix:/var/run/php/php8.2-fpm.sock;
        fastcgi_index index.php;
        include fastcgi_params;
        fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
    }

    # Logs
    access_log /var/log/nginx/cabinet.b2in.eu-access.log;
    error_log /var/log/nginx/cabinet.b2in.eu-error.log;
}

3. Umgebungsvariablen setzen

In der .env Datei auf dem Live-Server folgende Variablen hinzufügen/ändern:

# Display Configuration für Live-Server
DISPLAY_BASE_PATH=_cabinet
DISPLAY_SUBDOMAIN=cabinet
DISPLAY_DOMAIN=b2in.eu
APP_ENV=production

Wichtig: Nach dem Ändern der .env:

php artisan config:clear
php artisan cache:clear

4. API-Zugriff sicherstellen

Die API kann über zwei Wege erreichbar sein:

Option A: API über Hauptdomain (empfohlen)

  • API-URL: https://b2in.eu/api/display/config
  • Display-Seite lädt von Hauptdomain

Option B: API auch auf Subdomain

cd /var/www/html/public/_cabinet
ln -s ../api api
  • API-URL: https://cabinet.b2in.eu/api/display/config

5. Videos hochladen

Videos in den Cabinet-Ordner kopieren:

# Lokal zum Server
scp -r videos/*.mp4 user@liveserver:/var/www/html/public/_cabinet/assets/

# Im CMS hinzufügen
# Admin → CMS → Cabinet → Video hinzufügen

6. Testen

  1. Display-Seite: https://cabinet.b2in.eu/
  2. API-Test: https://b2in.eu/api/display/config
  3. Short-Link-Test: https://cabinet.b2in.eu/go.php?z=c59kjb
  4. CMS: Admin-Login → CMS → Cabinet
  5. QR-Code scannen und Tracking prüfen

Zugriffswege

Testserver

  • Display: http://portal.b2in.test/_cabinet/
  • Short-Link: http://portal.b2in.test/_cabinet/go.php?z=abc123
  • API: http://portal.b2in.test/api/display/config

Live-Server

  • Display: https://cabinet.b2in.eu/
  • Short-Link: https://cabinet.b2in.eu/go.php?z=abc123
  • API: https://b2in.eu/api/display/config

Wartung

Videos aktualisieren

  1. Neue Videos in public/_cabinet/assets/ hochladen
  2. Im CMS unter "Video-Playlist" hinzufügen
  3. Display lädt automatisch neue Konfiguration (max. 5 Min.)
  1. Im CMS unter "Footer-Inhalte" bearbeiten
  2. Short-Links bleiben gleich (nur Ziel-URL ändert sich)
  3. Klick-Statistiken bleiben erhalten

Logs prüfen

# Klick-Tracking
tail -f /var/www/html/public/_cabinet/clicks.log

# Laravel-Logs
tail -f /var/www/html/storage/logs/laravel.log

# Nginx-Logs
tail -f /var/log/nginx/cabinet.b2in.eu-access.log

Troubleshooting

Display zeigt "LADEN..." und lädt nicht

Ursache: API nicht erreichbar

Lösung:

  1. Browser-Console öffnen (F12)
  2. Netzwerk-Tab prüfen
  3. API-URL testen: curl https://b2in.eu/api/display/config
  4. CORS-Fehler? → API auch auf Subdomain verfügbar machen (siehe oben)

Ursache: go.php nicht ausführbar oder Datenbankverbindung fehlerhaft

Lösung:

# Dateiberechtigungen prüfen
ls -la /var/www/html/public/_cabinet/go.php

# Manuell testen
curl -I https://cabinet.b2in.eu/go.php?z=c59kjb

# Logs prüfen
tail -f /var/www/html/public/_cabinet/clicks.log

Videos werden nicht abgespielt

Ursache: Dateipfad falsch oder Video-Format nicht unterstützt

Lösung:

  1. Pfad prüfen: Videos müssen in assets/ liegen
  2. Format prüfen: .mp4 mit H.264-Codec empfohlen
  3. Browser-Console prüfen auf Fehler
  4. Im CMS prüfen: Sind Videos aktiv?

API gibt leere Arrays zurück

Ursache: Keine aktiven Inhalte in der Datenbank

Lösung:

# Prüfen
php artisan tinker
>>> App\Models\DisplayVideo::count()
>>> App\Models\DisplayFooterContent::count()

# Falls leer: Seeder ausführen
php artisan db:seed --class=DisplayContentSeeder

Performance-Optimierung

Video-Komprimierung

# FFmpeg für optimale Dateigröße
ffmpeg -i input.mp4 -c:v libx264 -crf 23 -preset medium \
       -c:a aac -b:a 128k output.mp4

Caching

Nginx-Caching für statische Assets:

location ~* \.(mp4|jpg|jpeg|png|gif|ico|css|js)$ {
    expires 7d;
    add_header Cache-Control "public, immutable";
}

Sicherheit

SSL/TLS

  • SSL-Zertifikat für cabinet.b2in.eu installieren
  • Automatische Erneuerung einrichten (z.B. Certbot)

Zugriffsbeschränkung

Falls gewünscht, Display-Seite per IP einschränken:

location / {
    allow 1.2.3.4;  # Ihre IP
    deny all;
    try_files $uri $uri/ /index.html;
}

Deployment-Checkliste

  • public/_cabinet/ Ordner vorhanden
  • Videos in public/_cabinet/assets/ hochgeladen
  • Subdomain cabinet.b2in.eu konfiguriert
  • Subdomain zeigt auf public/_cabinet/
  • .env aktualisiert mit korrekten Werten
  • php artisan config:clear ausgeführt
  • SSL-Zertifikat installiert
  • Display-Seite getestet: https://cabinet.b2in.eu/
  • API getestet: https://b2in.eu/api/display/config
  • Short-Link getestet
  • QR-Code gescannt und Tracking geprüft
  • Logs eingerichtet und überwacht

Support

Bei Problemen:

  1. Logs prüfen: clicks.log, laravel.log, nginx/apache logs
  2. Browser-Console: F12 → Console & Network Tabs
  3. API manuell testen: curl https://b2in.eu/api/display/config
  4. Datenbankverbindung testen: php artisan tinker
  5. Cache leeren: php artisan config:clear && php artisan cache:clear