Skip to content

Instantly share code, notes, and snippets.

@eberfreitas
Created March 11, 2016 06:33
Show Gist options
  • Save eberfreitas/8b0328595ca1ed6263c7 to your computer and use it in GitHub Desktop.
Save eberfreitas/8b0328595ca1ed6263c7 to your computer and use it in GitHub Desktop.
Caddy configuration for CakePHP 3 (and probably 2 as well) - Use this file on your project root
localhost:80
root webroot
fastcgi / 127.0.0.1:9000 php
rewrite {
to {path} {path}/ /index.php?{path}&{query}
}
log logs/server.log {
rotate {
size 100
age 14
keep 10
}
}
@maxtruxa
Copy link

maxtruxa commented Aug 8, 2022

With modern Caddy and php-fpm (and systemd for logging) this becomes something like this:

localhost:80 {
    root * webroot
    php_fastcgi unix//run/php/php7.4-fpm.sock
    file_server # If you also need to serve static assets
}

If you need to pass additional CGI env vars:

...
    php_fastcgi unix//run/php/php7.4-fpm.sock {
        env TLS_CLIENT_CERT {tls_client_certificate_der_base64}
        env FOO_BAR "baz qux"
    }
...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment