February 2018
Beginner to intermediate
348 pages
9h 40m
English
There are some cases where if is used inappropriately, in a way that risks saturating your storage device with useless checks:
location / {
# Redirect to index.php if the requested file is not found
if (!-e $request_filename) {
rewrite ^ index.php last;
}
}
With such a configuration, every single request received by Nginx will trigger a complete verification of the directory tree for the requested filename, thus requiring multiple storage disk access system calls. If you test /usr/local/nginx/html/hello.html, Nginx will check /, /usr, /usr/local, /usr/local/nginx, and so on. In any case, you should avoid resorting to such a statement; for example, by filtering the file type beforehand (for instance, by making such ...