Hi,
It could be good to be able to configure the root of a php_fastcgi directive like this:
root /usr/share/caddy
php_fastcgi 127.0.0.1:9000 {
root /var/www/html
}
This would allow path translation between Caddy and PHP-FPM. For example, we could have the application code in Caddy's default root (/usr/share/caddy) in the Caddy container and in PHP's default root (/var/www/html) in the PHP container.
A workaround is to use the expanded form of php_fastcgi:
root /usr/share/caddy
# Add trailing slash for directory requests
@canonicalPath {
file {
try_files {path}/index.php
}
not {
path */
}
}
redir @canonicalPath {path}/ 308
# If the requested file does not exist, try index files
try_files {path} {path}/index.php index.php
# Proxy PHP files to the FastCGI responder
@phpFiles {
path *.php
}
reverse_proxy @phpFiles <php-fpm_gateway> {
transport fastcgi {
root /var/www/html
split .php
}
}
This will get solved by this PR: https://github.com/caddyserver/caddy/pull/3255
Most helpful comment
This will get solved by this PR: https://github.com/caddyserver/caddy/pull/3255