| Server IP : 202.61.199.114 / Your IP : 216.73.217.139 Web Server : nginx/1.22.1 System : Linux de.arni-solutions.de 6.1.0-49-amd64 #1 SMP PREEMPT_DYNAMIC Debian 6.1.174-1 (2026-05-26) x86_64 User : web20 ( 1018) PHP Version : 8.4.23 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : OFF | Sudo : ON | Pkexec : ON Directory : /var/www/seaside2.pacim.de/web/ |
Upload File : |
<?php
/**
* Web-Entry-Point für ISPConfig + nginx.
*
* Liegt im Projekt-Stamm und entscheidet pro Request:
* - Falls noch keine Installation existiert (Marker `app/config/.installed`
* fehlt) → Redirect auf `/setup.php` (Installations-Wizard).
* - Statische Assets aus `public/assets/`, `public/uploads/` und `favicon.*`
* werden direkt durchgereicht (Komfort, falls nginx kein Alias hat).
* - Sonst: Delegation an die App in `public/index.php`.
*
* Empfohlene nginx-Konfiguration (DocumentRoot = Projekt-Stamm):
* location /assets/ { alias /pfad/zum/projekt/public/assets/; }
* location /uploads/ { alias /pfad/zum/projekt/public/uploads/; }
* try_files $uri $uri/ /index.php?$args;
*/
$installedMarker = __DIR__ . '/app/config/.installed';
$setupScript = __DIR__ . '/setup.php';
$publicIndex = __DIR__ . '/public/index.php';
$requestUri = (string)($_SERVER['REQUEST_URI'] ?? '/');
$requestPath = (string)(parse_url($requestUri, PHP_URL_PATH) ?: '/');
// 1) Nicht installiert → Wizard. Setup-Skript darf weiterhin direkt aufgerufen werden.
if (!file_exists($installedMarker)) {
if ($requestPath === '/setup.php' || str_starts_with($requestPath, '/setup.php')) {
require $setupScript;
exit;
}
header('Location: /setup.php');
exit;
}
// 2) Statische Assets aus public/ durchreichen — falls nginx kein Alias setzt.
$passThroughPrefixes = ['/assets/', '/uploads/'];
$isStatic = false;
foreach ($passThroughPrefixes as $p) {
if (str_starts_with($requestPath, $p)) { $isStatic = true; break; }
}
if (!$isStatic && preg_match('#^/favicon\.[a-z0-9]+$#i', $requestPath)) {
$isStatic = true;
}
if ($isStatic) {
$abs = realpath(__DIR__ . '/public' . $requestPath);
$root = realpath(__DIR__ . '/public');
if ($abs !== false && $root !== false && str_starts_with($abs, $root) && is_file($abs)) {
$ext = strtolower(pathinfo($abs, PATHINFO_EXTENSION));
$mime = match ($ext) {
'css' => 'text/css; charset=utf-8',
'js', 'mjs' => 'application/javascript; charset=utf-8',
'json' => 'application/json; charset=utf-8',
'svg' => 'image/svg+xml',
'png' => 'image/png',
'jpg', 'jpeg' => 'image/jpeg',
'gif' => 'image/gif',
'webp' => 'image/webp',
'ico' => 'image/x-icon',
'woff' => 'font/woff',
'woff2' => 'font/woff2',
'ttf' => 'font/ttf',
'otf' => 'font/otf',
'eot' => 'application/vnd.ms-fontobject',
'pdf' => 'application/pdf',
'map', 'txt' => 'text/plain; charset=utf-8',
default => function_exists('mime_content_type')
? (mime_content_type($abs) ?: 'application/octet-stream')
: 'application/octet-stream',
};
header('Content-Type: ' . $mime);
header('Content-Length: ' . filesize($abs));
header('Cache-Control: public, max-age=86400');
readfile($abs);
exit;
}
// 404 für unbekannte Asset-Anfrage — verhindert, dass die App den Pfad als Route interpretiert.
http_response_code(404);
echo 'Not Found';
exit;
}
// 3) Setup ist abgeschlossen → an die App weiterreichen.
require $publicIndex;