Move index.php to /public dir, so that I can isolate the file access

This commit is contained in:
Lewis Dale 2024-10-22 13:18:40 +01:00
parent dabab56245
commit 0f61dd1bc6
2 changed files with 4 additions and 3 deletions

View File

@ -1,2 +1,3 @@
[variables] [variables]
NIXPACKS_PHP_FALLBACK_PATH = "/index.php" NIXPACKS_PHP_FALLBACK_PATH = "/index.php"
NIXPACKS_PHP_ROOT_DIR = "/app/public"

View File

@ -1,9 +1,9 @@
<?php declare(strict_types=1); <?php declare(strict_types=1);
require_once __DIR__ . "/vendor/autoload.php"; require_once __DIR__ . "/../vendor/autoload.php";
if (php_sapi_name() === "cli-server" && preg_match('/\.(?:png|jpg|jpeg|gif|css|ico|js|mjs|css\.map|webp)$/', $_SERVER["REQUEST_URI"])) { if (php_sapi_name() === "cli-server" && preg_match('/\.(?:png|jpg|jpeg|gif|css|ico|js|mjs|css\.map|webp)$/', $_SERVER["REQUEST_URI"])) {
return false; // serve the requested resource as-is. return false; // serve the requested resource as-is.
} }
require_once __DIR__ . "/src/app.php"; require_once __DIR__ . "/../src/app.php";