dunglas / frankenphp

🧟 The modern PHP app server
https://frankenphp.dev
MIT License
6.85k stars 236 forks source link

White page when Caddfile and frakenphp is not located in the public directory #319

Closed ChrisRiddell closed 10 months ago

ChrisRiddell commented 11 months ago

Following the the Laravel Local install

If you place the binary and the Caddyfile inside the root of the project you get a white page with the following error with debug mode on even if you add the root * /public

{
    debug
    frankenphp
    order php_server before file_server
}

# The domain name of your server
localhost {
    root * /public
    # Enable compression (optional)
    encode zstd gzip
    # Execute PHP files in the current directory and serve assets
    php_server
}
DEBUG   http.log.error  {id=njy1jiua0} fileserver.(*FileServer).notFound (staticfiles.go:629): HTTP 404 
{
  "request": {
    "remote_ip": "::1",
    "remote_port": "49972",
    "client_ip": "::1",
    "proto": "HTTP/2.0",
    "method": "GET",
    "host": "localhost",
    "uri": "/",
    "headers": {
      "Cookie": [],
      "Accept-Encoding": [
        "gzip, deflate, br"
      ],
      "Sec-Fetch-Mode": [
        "navigate"
      ],
      "User-Agent": [
        "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/17.1 Safari/605.1.15"
      ],
      "Accept-Language": [
        "en-AU,en;q=0.9"
      ],
      "Sec-Fetch-Dest": [
        "document"
      ],
      "Accept": [
        "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8"
      ],
      "Sec-Fetch-Site": [
        "none"
      ]
    },
    "tls": {
      "resumed": false,
      "version": 772,
      "cipher_suite": 4865,
      "proto": "h2",
      "server_name": "localhost"
    }
  },
  "duration": 0.000409792,
  "status": 404,
  "err_id": "njy1jiua0",
  "err_trace": "fileserver.(*FileServer).notFound (staticfiles.go:629)"
}

It works as expected if you move the Caddyfile and binary in the /public directory making sure to remove root * /public from the Caddyfile

dunglas commented 10 months ago

Fixed now!