How do I exclude one folder from a try_files?
Francis Daly
francis at daoine.org
Sun Jun 25 18:03:27 UTC 2017
On Sun, Jun 25, 2017 at 07:50:10AM -0400, Joergi wrote:
Hi there,
> I already do have this location block in my config:
>
> location /wiki/images {
> # Separate location for /wiki/images
> try_files $uri =404;
> }
>
> However, the rewriting from location ~* "^/" { } is still taking place also
> inside folder /wiki/images. I want nginx to return the existing file or
> error 404. Shouldn't my block do exactly that?
As suggested, read https://nginx.org/en/docs/http/ngx_http_core_module.html#location
You want "^~".
You don't even need "try_files" -- just make sure that "root" is correct
in this location. Read the error log if the response is not what you want.
The config change will not take effect until a server reload or restart is done.
Good luck with it,
f
--
Francis Daly francis at daoine.org
More information about the nginx
mailing list