feat: add support for SERVER_ROOT to provide a different app root (#1678)

This commit is contained in:
Alexandre Daubois
2025-06-23 20:47:58 +02:00
committed by GitHub
parent cfb9d9f895
commit b2435183f4
5 changed files with 9 additions and 1 deletions

View File

@@ -25,7 +25,7 @@
#}
root {$SERVER_ROOT:public/}
encode zstd br gzip
encode zstd br gzip
# Uncomment the following lines to enable Mercure and Vulcain modules
#mercure {

View File

@@ -236,6 +236,7 @@ You can find more information about this setting in the [Caddy documentation](ht
The following environment variables can be used to inject Caddy directives in the `Caddyfile` without modifying it:
- `SERVER_NAME`: change [the addresses on which to listen](https://caddyserver.com/docs/caddyfile/concepts#addresses), the provided hostnames will also be used for the generated TLS certificate
- `SERVER_ROOT`: change the root directory of the site, defaults to `public/`
- `CADDY_GLOBAL_OPTIONS`: inject [global options](https://caddyserver.com/docs/caddyfile/options)
- `FRANKENPHP_CONFIG`: inject config under the `frankenphp` directive

View File

@@ -235,6 +235,7 @@ Vous trouverez plus d'informations sur ce paramètre dans la [documentation Cadd
Les variables d'environnement suivantes peuvent être utilisées pour insérer des directives Caddy dans le `Caddyfile` sans le modifier :
- `SERVER_NAME` : change [les adresses sur lesquelles écouter](https://caddyserver.com/docs/caddyfile/concepts#addresses), les noms d'hôte fournis seront également utilisés pour le certificat TLS généré
- `SERVER_ROOT` : change le répertoire racine du site, par défaut `public/`
- `CADDY_GLOBAL_OPTIONS` : injecte [des options globales](https://caddyserver.com/docs/caddyfile/options)
- `FRANKENPHP_CONFIG` : insère la configuration sous la directive `frankenphp`

View File

@@ -18,6 +18,9 @@ ENV SERVER_NAME=your-domain-name.example.com
# Si vous souhaitez désactiver HTTPS, utilisez cette valeur à la place :
#ENV SERVER_NAME=:80
# Si votre projet n'utilise pas le répertoire "public" comme racine web, vous pouvez le définir ici :
# ENV SERVER_ROOT=web/
# Activer les paramètres de production de PHP
RUN mv "$PHP_INI_DIR/php.ini-production" "$PHP_INI_DIR/php.ini"

View File

@@ -18,6 +18,9 @@ ENV SERVER_NAME=your-domain-name.example.com
# If you want to disable HTTPS, use this value instead:
#ENV SERVER_NAME=:80
# If your project is not using the "public" directory as the web root, you can set it here:
# ENV SERVER_ROOT=web/
# Enable PHP production settings
RUN mv "$PHP_INI_DIR/php.ini-production" "$PHP_INI_DIR/php.ini"