DOCROOT_SUBDIR: serve public_html/<sub> (Laravel/CodeIgniter/Symfony) for local dev

New env var DOCROOT_SUBDIR (default empty = unchanged bytes of the rendered vhost, verified by diff against the published image). Validated like WHP's panel/internal/vhost/docrootsub: ASCII letters, digits, . _ -; up to 4 segments, 64 bytes per segment, 128 total; no segment starting with . or -; no . / .. / empty segment; cgi-bin and the other reserved names refused; newline-safe. Invalid = FATAL message and exit 1. When set, DocumentRoot and the <Directory> move to public_html/<sub> and public_html itself gets Options None / AllowOverride None / Require all denied, the same shape WHP renders on the shared tier. The folder is created (as the customer) if missing. entrypoint now stops if create-vhost.sh fails.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_0185ukXi4YX5FxJGqhi6qab6
This commit is contained in:
shadowdaoandClaude Sonnet 5.5 committed 2026-11-23 06:03:24 -08:00
1 parent 2fe13fdab0
commit 55c1a2b284
4 files changed
+69 -5

No files matched your search

+5
View File
@@ -127,6 +127,7 @@ Then visit https://localhost (accept the SSL warning) to complete setup.
- `environment` – Set to `DEV` to start memcached and MariaDB locally for development (see "DEV mode" below)
- `serveralias` – Comma-separated list of alternative hostnames
- `PHPVER` – Informational only. The PHP version is the image tag; in DEV mode a mismatch prints a warning
- `DOCROOT_SUBDIR` – Serve `public_html/<subdir>` instead of `public_html` (e.g. `public`, `web/public`). Default empty = `public_html`, unchanged. Rules (same as the WHP panel): up to 4 folders; letters, digits, `.`, `_`, `-`; no folder starting with `.` or `-`; no `.`/`..`; `cgi-bin` is reserved. An invalid value stops the container with a message. The folder is created if missing. Everything above it (`vendor/`, `.env`, `app/`) is not reachable over HTTP, and `public_html/.htaccess` is no longer read
- `PUBLIC_HTTPS_PORT` – DEV only: the host port mapped to 443, so the HTTP to HTTPS redirect keeps it (e.g. `8443`)
**DEV mode only** (`environment=DEV`; production containers never read these):
@@ -151,6 +152,10 @@ Then visit https://localhost (accept the SSL warning) to complete setup.
Xdebug 3 is installed from the same Remi module stream as the image's PHP. Configure your IDE as a **debug client listening on port 9003**, with a path mapping from your project folder (`./user/public_html`) to `/home/<user>/public_html` in the container. The container connects out to `host.docker.internal:9003` (`--add-host host.docker.internal:host-gateway` is needed on Linux; `local-dev.sh` adds it). Use `XDEBUG_START=trigger` to debug only requests that carry the `XDEBUG_TRIGGER` cookie/parameter, and `XDEBUG_MODE=debug,develop` etc. to change the mode.
### Laravel / CodeIgniter 4 / Symfony style apps
These serve from a `public/` folder inside the project. Put the whole project in `user/public_html/` and start with `DOCROOT_SUBDIR=public` (`./local-dev.sh -n app -d public`): the web root becomes `public_html/public`, so `vendor/`, `.env` and `app/` are not served.
---
## Helpful Notes