title: nginx - create multiple cache paths
body: <p>I am new to nginx, so I'm not sure if this is possible.</p>
  
  <p>However, I am attempting to create <em>short</em>, <em>long</em>, and <em>never</em> caches for sites to use.</p>
  
  <p>I naively attempted to set these up in my <em>http</em> block:</p>
  
  <pre><code>proxy_cache_path /var/cache/nginx levels=1:2 keys_zone=short:10m;
  proxy_cache short;
  proxy_cache_key "short:$scheme$proxy_host$uri$is_args$args";
  proxy_cache_valid 2m;
  
  proxy_cache_path /data/nginx/cache levels=1:2 keys_zone=long:10m;
  proxy_cache long;
  proxy_cache_key "long:$scheme$proxy_host$uri$is_args$args";
  proxy_cache_valid 1h;
  
  proxy_cache_path /data/nginx/cache levels=1:2 keys_zone=day:10m;
  proxy_cache never;
  proxy_cache_key "long:$scheme$proxy_host$uri$is_args$args";
  proxy_cache_valid 1d;
  
  proxy_cache off;
  </code></pre>
  
  <p>Upon reload this throws the following error:</p>
  
  <blockquote>
    <p>[emerg]: "proxy_cache" directive is duplicate in</p>
  </blockquote>
  
  <p>How can I setup different cache paths to share among my virtual hosts?</p>