Posted by wmostrey on May 17, 2011 at 8:36am
Cfr http://keen.posterous.com/your-nginx-configuration-is-probably-wrong
This post describes how in certain situations using if (-f $request_filename) {} and if (!-e $request_filename) {} can lead to unwanted behavior. A proposed solution is to use try_files $uri /index.php?$args; instead.
Is this something that applies to Drupal sites as well? Is anyone experiences these issues?

Comments
Yes
that's the wrong way to do it. I didn't read the post you referenced. But it's wrong on a logical basis. Because you're trying to fit the Yoda style of reasoning that mod_rewrite promotes into the Nginx configuration. Nginx works in forward logical way, not reverse logic.
By using
try_filesyou're saying: try tostat()this file if not found then try the next thing. Furthermore by usingtry_filesyou're abstracting the control flow, it is left at the syscall level instead of placing at the config level. Last but least, Nginx config language is mostly declarative. The only exceptions being the directives provided by the rewrite module, namelyif, which are procedural.Using
try_filesis relying on the declarative paradigm. Using procedural features likeifor too much relying on regexes is bound to generate unwanted effects that mess up your setup. As rule of thumb don't use it if you can, if needed use it sparingly and try to use the "undocumented" best practices as wrapping regexes with nested locations.