@@ -28,38 +28,38 @@ First, we need to configure the server itself. Create `/.rr.yaml` and add the fo
2828``` yaml
2929server :
3030 command : " php worker.php"
31+ env :
32+ YII_ENV : prod
33+ YII_DEBUG : false
3134
3235rpc :
3336 listen : tcp://127.0.0.1:6001
3437
3538http :
3639 address : :8080
3740 pool :
38- num_workers : 4
39- max_jobs : 64
40- middleware : ["static", "headers"]
41+ debug : false # set to true for local development only
42+ supervisor :
43+ max_worker_memory : 192
44+ middleware : [static, gzip, headers, sendfile]
4145 static :
4246 dir : " public"
4347 forbid : [".php", ".htaccess"]
4448 headers :
4549 response :
4650 " Cache-Control " : " no-cache"
4751
48- reload :
49- interval : 1s
50- patterns : [ ".php" ]
51- services :
52- http :
53- recursive : true
54- dirs : [ "." ]
55-
5652logs :
5753 mode : production
5854 level : warn
5955` ` `
6056
61- We're specifying that entry script is ` worker.php`, there should be three workers on port 8080, `public` directory
62- files are static ones except `.php` and `.htaccess`. Also, we're sending an additional header.
57+ > [!INFO]
58+ > Read more about TLS, HTTP/2, HTTP/3 configuration and other middleware [on the RoadRunner docs](https://docs.roadrunner.dev/docs/http/http).
59+
60+ We're specifying that the entry script is ` worker.php`, the server listens on port 8080, `public` directory
61+ files are served statically except `.php` and `.htaccess`. The `max_worker_memory` is a soft limit : if a worker
62+ exceeds 192 MB, it will restart after finishing its current request. Also, we're sending an additional header.
6363
6464Create `/worker.php` :
6565
@@ -68,7 +68,6 @@ Create `/worker.php`:
6868
6969declare(strict_types=1);
7070
71-
7271use Yiisoft\Y ii\R unner\R oadRunner\R oadRunnerApplicationRunner;
7372
7473ini_set('display_errors', 'stderr');
@@ -83,7 +82,7 @@ require_once __DIR__ . '/preload.php';
8382To start a server, execute the following command :
8483
8584` ` `
86- ./rr serve -d
85+ ./rr serve
8786` ` `
8887
8988# # On worker scope
0 commit comments