# Quick Start: Proxy & Webspace Setup ## 🚀 Schnellstart für Code-Server Proxy ```bash # 1. .env erstellen cp .env.example .env # 2. .env anpassen nano .env # Setzen Sie: APP_BASE_PATH=/proxy/8080 # 3. Server starten php -S 0.0.0.0:8080 -t public public/router.php # 4. Zugriff über Browser # https://ihr-code-server.de/proxy/8080/ ``` ## 🌐 Schnellstart für Netcup Webspace ```bash # 1. Dateien hochladen (FTP/SFTP) # Document Root → /public/ # 2. .env erstellen cp .env.example .env # 3. .env anpassen nano .env # Setzen Sie: # APP_URL=https://ihre-domain.de # APP_BASE_PATH= # DB_HOST=localhost # DB_NAME=ihre_datenbank # DB_USER=ihr_benutzer # DB_PASS=ihr_passwort # 4. Rechte setzen chmod 755 storage/ storage/cache/ storage/logs/ storage/uploads/ # 5. Installation # Besuchen Sie: https://ihre-domain.de/install ``` ## ✅ Funktioniert automatisch Die Anwendung erkennt automatisch: - ✅ Code-Server Proxy (via `X-Forwarded-Prefix` Header) - ✅ Subdirectory-Installationen (via `APP_BASE_PATH`) - ✅ HTTPS hinter Reverse Proxy (via `X-Forwarded-Proto`) - ✅ Alle URLs werden dynamisch generiert ## 📖 Detaillierte Dokumentation Siehe: `docs/deployment-proxy-guide.md` ## 🔧 Konfigurationsoptionen ### .env Variablen für Proxy-Setup ```env # Für Code-Server Proxy APP_BASE_PATH=/proxy/8080 # Für Subdirectory (z.B. https://example.com/kaffeekasse/) APP_BASE_PATH=/kaffeekasse # Für Root-Installation (Standard) APP_BASE_PATH= ``` ### Manuelle Proxy-Prefix Überschreibung Falls automatische Erkennung nicht funktioniert: ```bash # Apache .htaccess SetEnv KAFFEEKASSE_PROXY_PREFIX /proxy/8080 # Nginx fastcgi_param KAFFEEKASSE_PROXY_PREFIX /proxy/8080; # PHP Development Server KAFFEEKASSE_PROXY_PREFIX=/proxy/8080 php -S 0.0.0.0:8080 -t public public/router.php ``` ## 🧪 Testen ```bash # Base Path prüfen php -r "require 'app/Support/helpers.php'; var_dump(base_path());" # URL-Generierung testen php -r " require 'app/Support/helpers.php'; \$_ENV['APP_BASE_PATH'] = '/proxy/8080'; echo url('/admin/login') . PHP_EOL; echo tenant_url('test', 'bookings') . PHP_EOL; echo asset_url('app.css') . PHP_EOL; " ``` ## 🐛 Troubleshooting ### URLs sind falsch ```bash # Debug-Ausgabe in public/index.php einfügen (temporär): var_dump([ 'base_path' => base_path(), 'current_path' => current_path(), 'REQUEST_URI' => $_SERVER['REQUEST_URI'] ?? null, 'X-Forwarded-Prefix' => $_SERVER['HTTP_X_FORWARDED_PREFIX'] ?? null, ]); exit; ``` ### CSS lädt nicht ```env # In .env explizit setzen: APP_BASE_PATH=/proxy/8080 ``` ### Sessions funktionieren nicht ```bash # Prüfen Sie Verzeichnisrechte: chmod 755 storage/ ls -la storage/ ``` ## 📋 Checkliste ### Code-Server Proxy - [ ] `.env` erstellt und `APP_BASE_PATH=/proxy/8080` gesetzt - [ ] PHP Server gestartet: `php -S 0.0.0.0:8080 -t public public/router.php` - [ ] Zugriff über `/proxy/8080/` funktioniert - [ ] CSS und Assets werden geladen - [ ] Login funktioniert ### Netcup Webspace - [ ] Dateien hochgeladen (Document Root → `/public/`) - [ ] `.env` erstellt und konfiguriert - [ ] `APP_BASE_PATH=` (leer gelassen) - [ ] Datenbank-Zugangsdaten eingetragen - [ ] Verzeichnisrechte gesetzt (755 für storage/) - [ ] Installation unter `/install` durchgeführt - [ ] HTTPS funktioniert - [ ] Login funktioniert ## 💡 Tipps ### Entwicklung mit Code-Server ```bash # Screen-Session für dauerhaften Betrieb screen -dmS kaffeekasse bash -c 'cd /config/workspace/kaffeeliste-neustart && php -S 0.0.0.0:8080 -t public public/router.php' # Session wieder verbinden screen -r kaffeekasse # Session beenden screen -X -S kaffeekasse quit ``` ### Production auf Netcup ```apache # HTTPS erzwingen in public/.htaccess RewriteCond %{HTTPS} off RewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301] ``` ### SQLite für Entwicklung ```env # Einfacher für lokale Entwicklung DB_HOST=sqlite DB_NAME=/config/workspace/kaffeeliste-neustart/storage/database.sqlite ``` ## 🔗 Weitere Ressourcen - **Vollständige Dokumentation**: `docs/deployment-proxy-guide.md` - **Deployment Guide**: `DEPLOY.md` - **Runbook**: `RUNBOOK.md` - **Netcup Checkliste**: `docs/go-live-checklist-netcup.md`