Solved thread

This post is marked as solved. If you think the information contained on this thread must be part of the official documentation, please contribute submitting a pull request to its repository.

nginx question - why have you commented out the try_files in the example blocks?

as subject - I notice that the line

try_files $uri =404;

Is commented out. Why?

thanks :)



83.4k
Accepted
answer

Because if the file does not exist it will produce a 404 not found and we need to rewrite it to the PHP router which will handle it later.

http://nginx.org/en/docs/http/ngx%5http%5core%5module.html#try%5files



976

Thank you. Forgive the perhaps silly question but does that protect against the upload attack?



83.4k

I think that is handled later by if (-f $request_filename) {



976

ok I'm confused :) I though If was evil? http://wiki.nginx.org/IfIsEvil



83.4k

It could be evil not always evil

PS: I also like to finish my phrases with :)