[edit] scgi_store

syntax: scgi_store on|off|path

default: scgi_store off

context: http, server, location

This directive sets the path in which upstream files are stored. The parameter "on" preserves files in accordance with path specified in directives alias or root. The parameter "off" forbids storing. Furthermore, the name of the path can be clearly assigned with the aid of the line with the variables:

scgi_store   /data/www$original_uri;

The time of modification for the file will be set to the date of "Last-Modified" header in the response. To be able to safe files in this directory it is necessary that the path is under the directory with temporary files, given by directive scgi_temp_path for the data location.

This directive can be used for creating the local copies for dynamic output of the backend which is not very often changed, for example:

location /images/ {
  root                /data/www;
  error_page          404 = /fetch$uri;
}
 
location /fetch {
  internal;
 
  scgi_pass           scgi://backend;
  scgi_store          on;
  scgi_store_access   user:rw  group:rw  all:r;
  scgi_temp_path      /data/temp;
 
  alias               /data/www;
}

To be clear scgi_store is not a cache, it's rather mirror on demand.


Module: HttpScgiModule