nginx: disable open_file_cache for specific file

Solution 1:

There's likely no way to win here through NGINX configuration alone. Even if you were able to disable open file caching for that single maintenance check file, it would probably not worth it in terms of performance. Think how this file would be constantly re-checked on every single request, over and over again... not good.

You probably will end up using systemctl reload nginx in order to clear up open file cache altogether, after switching the maintenance on or off. Which makes sense. Provided that maintenance was done in order to update/add/delete some files, you need to clear the entire open file cache, not just for the maintenance file.

Finally, as an alternative to putting open file cache on the entire site and using systemctl reload nginx after running maintenance enablement/disablement commands, you can simply locate where your static files are, and create the necessary locations and enabling open file cache only there (disabling on the http level).