Skip to content

Commit b243518

Browse files
feat: add support for SERVER_ROOT to provide a different app root (#1678)
1 parent cfb9d9f commit b243518

5 files changed

Lines changed: 9 additions & 1 deletion

File tree

caddy/frankenphp/Caddyfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@
2525
# }
2626
#}
2727

28-
root public/
28+
root {$SERVER_ROOT:public/}
2929
encode zstd br gzip
3030

3131
# Uncomment the following lines to enable Mercure and Vulcain modules

docs/config.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -236,6 +236,7 @@ You can find more information about this setting in the [Caddy documentation](ht
236236
The following environment variables can be used to inject Caddy directives in the `Caddyfile` without modifying it:
237237

238238
- `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
239+
- `SERVER_ROOT`: change the root directory of the site, defaults to `public/`
239240
- `CADDY_GLOBAL_OPTIONS`: inject [global options](https://caddyserver.com/docs/caddyfile/options)
240241
- `FRANKENPHP_CONFIG`: inject config under the `frankenphp` directive
241242

docs/fr/config.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -235,6 +235,7 @@ Vous trouverez plus d'informations sur ce paramètre dans la [documentation Cadd
235235
Les variables d'environnement suivantes peuvent être utilisées pour insérer des directives Caddy dans le `Caddyfile` sans le modifier :
236236

237237
- `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é
238+
- `SERVER_ROOT` : change le répertoire racine du site, par défaut `public/`
238239
- `CADDY_GLOBAL_OPTIONS` : injecte [des options globales](https://caddyserver.com/docs/caddyfile/options)
239240
- `FRANKENPHP_CONFIG` : insère la configuration sous la directive `frankenphp`
240241

docs/fr/production.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,9 @@ ENV SERVER_NAME=your-domain-name.example.com
1818
# Si vous souhaitez désactiver HTTPS, utilisez cette valeur à la place :
1919
#ENV SERVER_NAME=:80
2020

21+
# Si votre projet n'utilise pas le répertoire "public" comme racine web, vous pouvez le définir ici :
22+
# ENV SERVER_ROOT=web/
23+
2124
# Activer les paramètres de production de PHP
2225
RUN mv "$PHP_INI_DIR/php.ini-production" "$PHP_INI_DIR/php.ini"
2326

docs/production.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,9 @@ ENV SERVER_NAME=your-domain-name.example.com
1818
# If you want to disable HTTPS, use this value instead:
1919
#ENV SERVER_NAME=:80
2020

21+
# If your project is not using the "public" directory as the web root, you can set it here:
22+
# ENV SERVER_ROOT=web/
23+
2124
# Enable PHP production settings
2225
RUN mv "$PHP_INI_DIR/php.ini-production" "$PHP_INI_DIR/php.ini"
2326

0 commit comments

Comments
 (0)