How it works...
Firstly, the first parameter to the proxy_cache_path directive is the location of the cache files. You can choose any directory which makes sense to your server structure, but ensure that the NGINX user on your server has write access.
The levels parameter specifies how the cache is written to the system. In our recipe, we have specified 1:2. This means that the files are stored in a two-level hierarchy. The reason this is configurable is due to potential slowdowns when there are thousands of files within a single directory. Having two levels is a good way to ensure this never becomes an issue.
The third parameter, keys_zone, sets aside memory to store metadata about the cached content. Rather than a potentially expensive ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access