{{tag>nginx fastcgi}}

====== fastcgi_module ======

[[http://nginx.org/ru/docs/http/ngx_http_fastcgi_module.html|Описание]]
===== fastcgi_params =====

Применяется для увеличения времени ожидания между nginx и fastcgi сервером (php-fpm) \\
Как правило применяется при отладке

  * fastcgi_connect_timeout 256s;
  * fastcgi_read_timeout 256s;
  * fastcgi_send_timeout 256s;

===== fastcgi_cache =====

==== conf.d ====

  * fastcgi_cache_path /var/cache/nginx levels= keys_zone=**nginxcache**:1024m max_size=20480m inactive=7d;

==== location ====


  * fastcgi_cache_bypass $no_cache; (Не берется из кеша)
  * fastcgi_no_cache $cookie_nocache $no_cache; (Не сохраняется в кеш)
  * fastcgi_cache **nginxcache**;
  * fastcgi_cache_valid 200 301 302 304 1m;


  * fastcgi_cache_key "$server_addr : $server_port / $request_uri $http_cookie $request_method $session_id";

# Гарантируем, что разные пользователи не получат одну и ту же сессионную Cookie.

  * fastcgi_hide_header "Set-Cookie";

# Заставляем nginx кэшировать страницу в любом случае, независимо от заголовков кэширования, выставляемых в PHP.

  * fastcgi_ignore_headers "Cache-Control" "Expires" "Set-Cookie"; 

# Выдаем всегда свежий Last-Modified.

  * expires -1;
  * add_header Last-Modified $sent_http_Expires;

# Выдаем всегда свежий Last-Modified.

  * fastcgi_cache_use_stale updating error timeout invalid_header http_500;

===== Ссылки =====

  * http://habrahabr.ru/post/72539/
  * http://habrahabr.ru/post/95613/
  * http://habrahabr.ru/post/71501/
  * http://adw0rd.com/2010/nginx-fastcgi-cache/
  * http://highload.com.ua/index.php/2010/12/03/%D0%B8%D1%81%D0%BF%D0%BE%D0%BB%D1%8C%D0%B7%D1%83%D0%B5%D0%BC-nginx-%D0%BA%D0%B0%D0%BA-%D0%BA%D0%B5%D1%88%D0%B8%D1%80%D1%83%D1%8E%D1%89%D0%B8%D0%B9-%D1%81%D0%B5%D1%80%D0%B2%D0%B5%D1%80/
  * http://www.odmin4eg.ru/tag/nginx/
  * http://habrahabr.ru/qa/16616/
  * http://habrahabr.ru/qa/17048/
  * http://habrahabr.ru/post/139968/
  * http://habrahabr.ru/qa/17427/

