NGINX setup to serve static assets directly while PHP requests are proxied

Utilize nginx to serve static files (non-.php) and forward PHP or missing file requests to the backend. Example:

location / {
  if (-f $doc_root$uri && $uri !~* \.php$) {
    root /var/www/content;
    expires 30d;
    break;
  }
  proxy_set_header Client-IP $remote_addr;
  proxy_pass http://127.0.0.1:9090;
}

hey, love the setup! i wonder if anyone tried replacing the if block with try_files? seems like it could streamline stuff. what perf impact did you notice using this method versus a more dynamic rewrite? curious to know other ppl’s experince.