Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 14 additions & 15 deletions src/guide/tutorial/using-yii-with-roadrunner.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,38 +28,38 @@ 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

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"]
headers:
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`:

Expand All @@ -68,7 +68,6 @@ Create `/worker.php`:

declare(strict_types=1);


use Yiisoft\Yii\Runner\RoadRunner\RoadRunnerApplicationRunner;

ini_set('display_errors', 'stderr');
Expand All @@ -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
Expand Down