Equivalent of Apache's SetEnv Variable

Michael Shadle mike503 at gmail.com
Thu Aug 26 15:18:22 MSD 2010

On Thu, Aug 26, 2010 at 4:07 AM, Ed W <lists at wildgooses.com> wrote:
>  Slow reply - apologies

There is a quick hack, that should work, but does add at least another
stat call or two. Basically it's one last additional "is this -really-
a file" check. Of course it does require nginx to have filesystem
access (not a remote fastcgi_pass)

It was something along the lines of:

location ~ \.php$ {
    try_files $uri @404; # have to make a named 404 location then.

Or this is probably a bit clearer, but more evil because it uses "if"

location ~ \.php$ {
    if (!-f $request_filename) { return 404; } # or whatever you want to return

More information about the nginx mailing list