fastcgi_cache_path / tmp / nginx / levels = 1: 2 keys_zone = fastcgi_cache: 16m max_size = 256m inactive = 1d;
location ~ \ .php $ { # Standard configuration for php fastcgi_pass unix: /tmp/php-fcgi.sock; fastcgi_index index.php; fastcgi_param SCRIPT_FILENAME / usr / local / www / somedir / $ fastcgi_script_name; include fastcgi_params; fastcgi_param DOCUMENT_ROOT / usr / local / www / somedir /; fastcgi_pass_header Cookie; # Required to pass a cookie to the corresponding variables, for example a cookie named phpsessid will be in the $ cookie_phpsessid variable fastcgi_ignore_headers Cache-Control Expires Set-Cookie; # Ignore caching headers received from FastCGI server fastcgi_cache_key "$ server_addr: $ server_port $ request_uri | $ cookie_phpsessid"; # We form a unique key; in this case, we distinguish users using $ cookie_phpsessid fastcgi_cache fastcgi_cache; # We are talking about using the fastcgi_cache above-declared cache zone fastcgi_temp_path / tmp / nginx / temp 1 2; # Specify the folder for storing temporary files update_time_add_ http_500; # Use the cache option (even if it is outdated) in case of an error fastcgi_cache_valid 10s; # Life time for answer cache 200, 301 & 302 #fastcgi_cache_valid any 10s; # This way you can cache any answers. }
Source: https://habr.com/ru/post/71501/
All Articles