Symfony CaddyFile

I have tried to move my Symfony project to Caddy server environment, but I have problem with configuring it correctly.

Got so far as to load landing page and subpages, but no assets.

Here is my CaddyFile:

http://xxxxxxxx.dev:80 {
    tls off

    root /Users/xxxxxxx/projects/pk/web

    fastcgi / 127.0.0.1:9000 php {
        index app.php
    }

    rewrite {
        to /app.php?{query}
    }

    log /Users/xxxxxxx/.valet/Log/access.log {
        rotate {
            size 10
            age 3
            keep 1
        }
    }

    errors {
        log /Users/xxxxxxx/.valet/Log/error.log {
            size 10
            age 3
            keep 1
         }
    }
}

If any one could share example CaddyFile for Symfony and add it here GitHub - caddyserver/examples: OBSOLETE. This repo was for Caddy v1. For v2 and newer, see our forum's wiki category. for others to have, would help community a lot.

You need to add a condition to your rewrite clause so that your static files are served instead of calling PHP. Assuming your static files are under /static, you could try this clause (you will need Caddy 0.10.3 or higher for this, I believe):

rewrite {
     if {path} not_starts_with /static
     to /app.php?{query}
}

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.