I think you need to use the expanded form of php_fastcgi instead and make the appropriate modifications for it to also handle *.html.
What you’re trying to do is outside the norm of typical PHP apps, so it’s not supported out of the box with the php_fastcgi directive, but you can do it the long way.
Well, you’re doing something atypical. The php_fastcgi directive was designed for serving modern PHP apps that use index.php for routing. If you’re not doing that, then you need to do things manually.
You’d replace your php_fastcgi line with this:
route {
# Add trailing slash for directory requests
@canonicalPath {
file {path}/index.php
not path */
}
redir @canonicalPath {path}/ 308
# If the requested file does not exist, try index files
@indexFiles file {
try_files {path} {path}/index.php index.php
split_path .php
}
rewrite @indexFiles {http.matchers.file.relative}
# Proxy PHP files to the FastCGI responder
@phpFiles path *.php *.html
reverse_proxy @phpFiles unix//run/php/php7.4-fpm.sock {
transport fastcgi {
split .php
}
}
}
But that said, I realized that the split option of php_fastcgi might be all you need to make this work: