Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I'm new to Nginx. My nginx cache setting in the nginx.conf

fastcgi_cache_path  /dev/shm levels=1:2 keys_zone=my-cache:100m inactive=7d;

What is it means? the level, 100m and inactive=7d ?

Thank's in advaced.

share|improve this question
up vote 1 down vote accepted

From the Nginx conf page:

"Level parameter sets number and width of the names of subdirectories used to store caching files."

In other words, if you set your cache to /dev/shm levels=1:2 and you go into /dev/shm you will see tons of folders whose name is 1 character long. Underneath each of those folders, you will see more folders whose names are 2 characters long. Underneath each of those folders will be the actual cached data.

Regarding keys_zone and inactive:

"In addition, all active keys and information about data are stored in a shared memory zone, whose name and size are configured by the keys_zone parameter. Cached data that are not accessed during the time specified by the inactive parameter get removed from the cache regardless of their freshness. By default, inactive is set to 10 minutes."

The keys_zone parameter essentially acts as an "address book" to all the files in the cache. The name parameter simply names the keys_zone area for this nginx instance and the size parameter increases/decreases the total size available to be filled up with keys. In other words, the larger your cache(read: inactive set high) and the higher your traffic, the larger you want your keys_zone to be if you want to be able to cache everything.

share|improve this answer
Ok, i got the level key keys_zone name (my-cache) and inactive, but what the 100m (100 minutes) mean? – imastar Jan 26 '13 at 18:50
It's not minutes, it's size. It means that the keys_zone file will store keys up until it reaches it's maximum size of 100MB – Marcos Velazquez Jan 26 '13 at 19:08
I see... Thank you. – imastar Jan 26 '13 at 20:26

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.