Getting worker mode to work #518
-
I'm trying the simplest worker possible: while (true) {
\frankenphp_handle_request(static function(): void {
echo 'Hello, World!';
});
} This is a I'm running using Docker (tried the binary, but same error) with the command: docker run \
-e CADDY_GLOBAL_OPTIONS=debug \
-e FRANKENPHP_CONFIG="worker worker.php" \
-v $PWD:/app \
-p 80:80 -p 443:443 -p 443:443/udp \
dunglas/frankenphp I see things like {"level":"debug","ts":1706380729.0765274,"msg":"starting","worker":"/app/worker.php"} and {"level":"debug","ts":1706380729.1433651,"msg":"waiting for request","worker":"/app/worker.php"} But when I try with: curl -vk https://localhost I get < HTTP/2 404
< alt-svc: h3=":443"; ma=2592000
< server: Caddy
< content-length: 0
< date: Sat, 27 Jan 2024 18:39:09 GMT
<
* Connection #0 to host localhost left intact What am I missing here? |
Beta Was this translation helpful? Give feedback.
Answered by
dunglas
Jan 28, 2024
Replies: 2 comments
-
The worker script should be named The path of the worker script MUST be the path of the file loaded in the public directory of the app. |
Beta Was this translation helpful? Give feedback.
0 replies
Answer selected by
leocavalcante
-
Hmm! Thanks. mkdir public
mv worker.php public/index.php Then docker run \
-e CADDY_GLOBAL_OPTIONS=debug \
-e FRANKENPHP_CONFIG="worker public/index.php" \
-v $PWD:/app \
-p 80:80 -p 443:443 -p 443:443/udp \
dunglas/frankenphp |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
The worker script should be named
public/index.php
.The path of the worker script MUST be the path of the file loaded in the public directory of the app.