try_files does not have any effect on existing files

Francis Daly francis at
Sun Feb 19 19:41:36 UTC 2017

On Sun, Feb 19, 2017 at 12:42:11PM -0500, weheartwebsites wrote:

Hi there,

> This means, I can not for example overwrite an existing physical file
> location with a config like this:
> location / {
>   try_files /$host$uri /index.php
> }
> Since if $uri exists under the root/alias it will be served directly without
> triggering that try_files directive.

Can you give one specific example here, please?

What request do you make; what response to do want; what response do
you get instead?

I imagine it will be something like "I request /abc; I want the contents
of the file /usr/local/nginx/html/localhost/abc; but I get the contents
of the file /usr/local/nginx/html/abc instead".

But it will be good to be clear on what you expect to happen.


Francis Daly        francis at

More information about the nginx mailing list