Nginx Try Files
In the configuration syntax for nginx(8), the try_files directive is used to route requests based on the local file system.
Contents
Usage
Generally, a location maps to a directory of the local file system. The try_files directive checks if a file exists and reroutes if the file cannot be found.
In the below example, if $uri does not exist, the request is routed to the @uwsgi location.
try_files $uri @uwsgi; location / { root /var/www; } location @uwsgi { include uwsgi_params; uwsgi_pass unix:///run/myapp.sock; } location ~ .(png|gif|jpe?g)$ { root /usr/local/share/myapp/static; } location = /robots.txt { root /var/www; }