How to ignore php_fastcgi's try_files

The following caddyfile

https://example {
    log {
        output stdout
    }
    root * /srv/www/site1
    file_server {
        index index.html index.htm index.php
    }
    php_fastcgi 127.0.0.1:9002
}

When /not-found-file is requested. The site’s homepage content is returned and the status code is 200.

How can I configure this to return caddy’s default 404 response directly when a php file does not exist, without any special handling. like nginx

server {
    root /
    location \.php$ { fastcgi_pass ... ; } 
}

There’s an example for this in the docs: php_fastcgi (Caddyfile directive) — Caddy Documentation

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