I found my answer here at stackoverflow and it worked
basically, it needs to tell the absolute path of php-fpm with the root directive insde php_fastcgi
localhost:80 {
root * /srv/www
encode gzip
php_fastcgi php:9000 {
root /var/www/html
}
file_server
log
}
then, i had to take care of permissions, because even if caddy is run as root, php-fpm is run as www-data , so the directory ownership need to be assigned to that