mirror of
https://github.com/dunglas/frankenphp
synced 2024-11-23 08:39:21 +00:00
docs: customizing the configuration (#911)
* docs: customizing the configuration * Update docs/config.md Co-authored-by: Jacob Dreesen <jacob@hdreesen.de> * Update docs/fr/config.md Co-authored-by: Jacob Dreesen <jacob@hdreesen.de> * Update embed.md --------- Co-authored-by: Jacob Dreesen <jacob@hdreesen.de>
This commit is contained in:
parent
0500ebc191
commit
e743f6ab87
@ -2,11 +2,11 @@
|
||||
|
||||
FrankenPHP, Caddy as well as the Mercure and Vulcain modules can be configured using [the formats supported by Caddy](https://caddyserver.com/docs/getting-started#your-first-config).
|
||||
|
||||
In the Docker image, the `Caddyfile` is located at `/etc/caddy/Caddyfile`.
|
||||
In [the Docker images](docker.md), the `Caddyfile` is located at `/etc/caddy/Caddyfile`.
|
||||
|
||||
You can also configure PHP using `php.ini` as usual.
|
||||
|
||||
In the Docker image, the `php.ini` file is not present, you can create it manually or copy an official template:
|
||||
In the Docker images, the `php.ini` file is not present, you can create it manually or copy an official template:
|
||||
|
||||
```dockerfile
|
||||
FROM dunglas/frankenphp
|
||||
@ -18,6 +18,9 @@ RUN cp $PHP_INI_DIR/php.ini-development $PHP_INI_DIR/php.ini
|
||||
RUN cp $PHP_INI_DIR/php.ini-production $PHP_INI_DIR/php.ini
|
||||
```
|
||||
|
||||
The static binary will look for a `php.ini` file in the current working directory,
|
||||
in `/usr/local/lib/` as well as [the other standard locations](https://www.php.net/manual/en/configuration.file.php).
|
||||
|
||||
## Caddyfile Config
|
||||
|
||||
To register the FrankenPHP executor, the `frankenphp` [global option](https://caddyserver.com/docs/caddyfile/concepts#global-options) must be set, then the `php_server` or the `php` [HTTP directives](https://caddyserver.com/docs/caddyfile/concepts#directives) may be used within the site blocks to serve your PHP app.
|
||||
|
@ -2,7 +2,7 @@
|
||||
|
||||
FrankenPHP has the ability to embed the source code and assets of PHP applications in a static, self-contained binary.
|
||||
|
||||
Thanks to this feature, PHP applications can be distributed as standalone binaries that include the application itself, the PHP interpreter and Caddy, a production-level web server.
|
||||
Thanks to this feature, PHP applications can be distributed as standalone binaries that include the application itself, the PHP interpreter, and Caddy, a production-level web server.
|
||||
|
||||
Learn more about this feature [in the presentation made by Kévin at SymfonyCon 2023](https://dunglas.dev/2023/12/php-and-symfony-apps-as-standalone-binaries/).
|
||||
|
||||
@ -12,12 +12,12 @@ For embedding Laravel applications, [read this specific documentation entry](lar
|
||||
|
||||
Before creating the self-contained binary be sure that your app is ready for embedding.
|
||||
|
||||
For instance you likely want to:
|
||||
For instance, you likely want to:
|
||||
|
||||
* Install the production dependencies of the app
|
||||
* Dump the autoloader
|
||||
* Enable the production mode of your application (if any)
|
||||
* Strip uneeded files such as `.git` or tests to reduce the size of your final binary
|
||||
* Strip unneeded files such as `.git` or tests to reduce the size of your final binary
|
||||
|
||||
For instance, for a Symfony app, you can use the following commands:
|
||||
|
||||
@ -42,6 +42,11 @@ composer install --ignore-platform-reqs --no-dev -a
|
||||
composer dump-env prod
|
||||
```
|
||||
|
||||
### Customizing the Configuration
|
||||
|
||||
To customize [the configuration](config.md), you can put a `Caddyfile` as well as a `php.ini` file
|
||||
in the main directory of the app to be embedded (`$TMPDIR/my-prepared-app` in the previous example).
|
||||
|
||||
## Creating a Linux Binary
|
||||
|
||||
The easiest way to create a Linux binary is to use the Docker-based builder we provide.
|
||||
@ -107,7 +112,7 @@ If your app contains a [worker script](worker.md), start the worker with somethi
|
||||
./my-app php-server --worker public/index.php
|
||||
```
|
||||
|
||||
To enable HTTPS (a Let's Encrypt certificate is automatically created), HTTP/2 and HTTP/3, specify the domain name to use:
|
||||
To enable HTTPS (a Let's Encrypt certificate is automatically created), HTTP/2, and HTTP/3, specify the domain name to use:
|
||||
|
||||
```console
|
||||
./my-app php-server --domain localhost
|
||||
|
@ -18,6 +18,9 @@ RUN cp $PHP_INI_DIR/php.ini-development $PHP_INI_DIR/php.ini
|
||||
RUN cp $PHP_INI_DIR/php.ini-production $PHP_INI_DIR/php.ini
|
||||
```
|
||||
|
||||
Le binaire statique cherchera un fichier `php.ini` dans le répertoire de travail courant,
|
||||
dans `/usr/local/lib/` ainsi que [les autres emplacements standards](https://www.php.net/manual/fr/configuration.file.php).
|
||||
|
||||
## Configuration du Caddyfile
|
||||
|
||||
Pour enregistrer l'exécutable de FrankenPHP, l'[option globale](https://caddyserver.com/docs/caddyfile/concepts#global-options) `frankenphp` doit être définie, puis les [directives HTTP](https://caddyserver.com/docs/caddyfile/concepts#directives) `php_server` ou `php` peuvent être utilisées dans les blocs de site pour servir votre application PHP.
|
||||
|
@ -39,6 +39,13 @@ composer install --ignore-platform-reqs --no-dev -a
|
||||
composer dump-env prod
|
||||
```
|
||||
|
||||
### Personnaliser la configuration
|
||||
|
||||
Pour personnaliser [la configuration](config.md),
|
||||
vous pouvez mettre un fichier `Caddyfile` ainsi qu'un fichier `php.ini`
|
||||
dans le répertoire principal de l'application à intégrer
|
||||
(`$TMPDIR/my-prepared-app` dans l'exemple précédent).
|
||||
|
||||
## Créer un binaire Linux
|
||||
|
||||
La manière la plus simple de créer un binaire Linux est d'utiliser le builder basé sur Docker que nous fournissons.
|
||||
|
Loading…
Reference in New Issue
Block a user