frankenphp icon indicating copy to clipboard operation
frankenphp copied to clipboard

Trying to build-static without docker can only access app with explicit /index.php (especially using Caddyfile)

Open sawirricardo opened this issue 1 year ago • 3 comments

What happened?

cd ~ && git clone https://github.com/dunglas/frankenphp
cd ~ && composer create-project laravel/laravel build-static-laravel

Add Caddyfile

{
frankenphp
order php_server before file_server
}

# need to use port other than 80
:81 {
root * /public
encode zstd br gzip
php_server
}

then execute

cd ~/frankenphp && EMBED=~/build-static-laravel ./build-static.sh
./dist/frankenphp-mac-arm64 php-server

Here we have to access explicitly the index.php file like http://localhost:81/index.php instead of http://localhost:81 other explicit files such as http://localhost:81/robots.txt are being served fine

Build Type

Standalone binary

Worker Mode

No

Operating System

macOS

CPU Architecture

Apple Silicon

PHP configuration

none

Relevant log output

No response

sawirricardo avatar Mar 15 '24 00:03 sawirricardo

Yesterday I was pulling my hair off with this too, didn't manage anything cause files are on an unzipped folder inside /tmp therefore no idea where they were pointing...

To me I was using the latest dev version (which I thing is more or less the same as this repo's master branch?): dunglas/frankenphp-dev:static-builder

Also: I'm using same kind of machine, did you get this UPX thing compressing stuff super slow too?

d8vjork avatar Mar 15 '24 09:03 d8vjork

Adding this to the server/location block (no idea how is called in Caddy):

rewrite * /index.php?{query}&p={path}

Made everything work, might be some mistake from any parent/inherited config from FrankenPHP into the static-builder?

d8vjork avatar Mar 15 '24 21:03 d8vjork

Hm, I'm not sure, may as well need official comment for this @dunglas

sawirricardo avatar Apr 04 '24 03:04 sawirricardo