xin

try_files

Tests candidate files and falls back to a URI, named location or status.

Syntaxtry_files file ... uri;
Contextsserverlocation

Behavior

Candidates use the active root or alias. Only the final argument is a fallback; earlier arguments are filesystem probes.

At server level it applies only to requests that match no location, and is not inherited by a location.

Example

try_files $uri $uri/ @app;

Related directives

root · alias · location