You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/config.md
+64-12Lines changed: 64 additions & 12 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -94,13 +94,38 @@ Alternatively, you may use the one-line short form of the `worker` option:
94
94
# ...
95
95
```
96
96
97
+
Worker blocks can also be defined inside a `php` or `php_server` block. In this case, the worker inherits environment variables and root path from the parent directive and is only accessible by that specific domain:
98
+
99
+
```caddyfile
100
+
{
101
+
frankenphp
102
+
}
103
+
example.com {
104
+
root /path/to/app
105
+
php_server {
106
+
root <path>
107
+
worker {
108
+
file <path, can be relative to root>
109
+
num <num>
110
+
env <key> <value>
111
+
watch <path>
112
+
name <name>
113
+
}
114
+
}
115
+
}
116
+
```
117
+
97
118
You can also define multiple workers if you serve multiple apps on the same server:
98
119
99
120
```caddyfile
100
121
{
101
122
frankenphp {
102
123
worker /path/to/app/public/index.php <num>
103
-
worker /path/to/other/public/index.php <num>
124
+
worker {
125
+
file /path/to/other/public/index.php
126
+
num <num>
127
+
env APP_ENV dev
128
+
}
104
129
}
105
130
}
106
131
@@ -111,7 +136,34 @@ app.example.com {
111
136
112
137
other.example.com {
113
138
root /path/to/other/public
114
-
php_server
139
+
php_server {
140
+
env APP_ENV dev
141
+
}
142
+
}
143
+
144
+
# ...
145
+
```
146
+
147
+
Is equivalent to
148
+
149
+
```caddyfile
150
+
{
151
+
frankenphp
152
+
}
153
+
154
+
app.example.com {
155
+
php_server {
156
+
root /path/to/app/public
157
+
worker index.php <num>
158
+
}
159
+
}
160
+
161
+
other.example.com {
162
+
php_server {
163
+
root /path/to/other/public
164
+
env APP_ENV dev
165
+
worker index.php <num>
166
+
}
115
167
}
116
168
117
169
# ...
@@ -149,7 +201,7 @@ The `php_server` and the `php` directives have the following options:
149
201
150
202
```caddyfile
151
203
php_server [<matcher>] {
152
-
root <directory> # Sets the root folder to the site. Default: `root` directive. If not specified, it will use the current_working_dir/public directory by default.
204
+
root <directory> # Sets the root folder to the site. Default: `root` directive.
153
205
split_path <delim...> # Sets the substrings for splitting the URI into two parts. The first matching substring will be used to split the "path info" from the path. The first piece is suffixed with the matching substring and will be assumed as the actual resource (CGI script) name. The second piece will be set to PATH_INFO for the script to use. Default: `.php`
154
206
resolve_root_symlink false # Disables resolving the `root` directory to its actual value by evaluating a symbolic link, if one exists (enabled by default).
155
207
env <key> <value> # Sets an extra environment variable to the given value. Can be specified more than once for multiple environment variables.
@@ -212,7 +264,7 @@ This is an opt-in configuration that needs to be added to the global options in
212
264
```caddyfile
213
265
{
214
266
servers {
215
-
enable_full_duplex
267
+
enable_full_duplex
216
268
}
217
269
}
218
270
```
@@ -252,16 +304,16 @@ You can also change the PHP configuration using the `php_ini` directive in the `
0 commit comments