diff --git a/src/guide/tutorial/using-yii-with-roadrunner.md b/src/guide/tutorial/using-yii-with-roadrunner.md index c897f591..5f86dea6 100644 --- a/src/guide/tutorial/using-yii-with-roadrunner.md +++ b/src/guide/tutorial/using-yii-with-roadrunner.md @@ -28,6 +28,9 @@ First, we need to configure the server itself. Create `/.rr.yaml` and add the fo ```yaml server: command: "php worker.php" + env: + YII_ENV: prod + YII_DEBUG: false rpc: listen: tcp://127.0.0.1:6001 @@ -35,9 +38,10 @@ rpc: http: address: :8080 pool: - num_workers: 4 - max_jobs: 64 - middleware: ["static", "headers"] + debug: false # set to true for local development only + supervisor: + max_worker_memory: 192 + middleware: [static, gzip, headers, sendfile] static: dir: "public" forbid: [".php", ".htaccess"] @@ -45,21 +49,17 @@ http: response: "Cache-Control": "no-cache" -reload: - interval: 1s - patterns: [ ".php" ] - services: - http: - recursive: true - dirs: [ "." ] - logs: mode: production level: warn ``` -We're specifying that entry script is `worker.php`, there should be three workers on port 8080, `public` directory -files are static ones except `.php` and `.htaccess`. Also, we're sending an additional header. +> [!INFO] +> Read more about TLS, HTTP/2, HTTP/3 configuration and other middleware [on the RoadRunner docs](https://docs.roadrunner.dev/docs/http/http). + +We're specifying that the entry script is `worker.php`, the server listens on port 8080, `public` directory +files are served statically except `.php` and `.htaccess`. The `max_worker_memory` is a soft limit: if a worker +exceeds 192 MB, it will restart after finishing its current request. Also, we're sending an additional header. Create `/worker.php`: @@ -68,7 +68,6 @@ Create `/worker.php`: declare(strict_types=1); - use Yiisoft\Yii\Runner\RoadRunner\RoadRunnerApplicationRunner; ini_set('display_errors', 'stderr'); @@ -83,7 +82,7 @@ require_once __DIR__ . '/preload.php'; To start a server, execute the following command: ``` -./rr serve -d +./rr serve ``` ## On worker scope