FastCGI tuning (with PHP engine dynamic service)
Fastcgi_connect_timeout 300;
#指定连接到后端 FastCGI Time-out
Fastcgi_send_timeout 300;
#向 the time-out of the FastCGI transfer request, which is the time-out for sending the request to FastCGI after two handshake has been completed.
Fastcgi_read_timeout 300;
#指定接收 the time-out of the FastCGI response, which is the time-out for receiving FastCGI answers after two handshakes have been completed.
Fastcgi_buffer_size 64k;
#指定读取 FastCGI Answer the first part of the response needs to use a large buffer, this value indicates that the first part of the 1 64KB buffer read Answer (the answer header), you can set the Fastcgi_buffers option to specify the buffer size.
Fastcgi_buffers 4 64k;
#指定本地需要用多少和多大的缓冲区来缓冲 the FastCGI response request. If a PHP script produces a page size of 256KB, it is allocated a buffer of 4 64KB to cache, if the page size is greater than 256KB, then the portion greater than 256KB will be cached in the path specified by fastcgi_temp, but this is not a good way, because the memory Data processing speed is faster than hard disk. Generally this value should be the site PHP script generated by the middle of the page size, if most of the site script generated by the page size of 256KB, then you can set this value to "16k", "4 64k" and so on.
Fastcgi_busy_buffers_size 128k;
Twice Times #建议为 Fastcgi_buffers.
Fastcgi_temp_file_write_size 128k;
#在写入 Fastcgi_temp_path When the data block will be used, the default value is Fastcgi_buffers twice times, set the above values set too small if the load may be reported 502 bad Gateway
Fastcgi_cache Oldboy_nginx
#表示开启 FastCGI The cache and assigns a name to it. Enabling caching is useful for reducing the load on the CPU and preventing 502 errors, but opening the cache can also cause other problems, depending on the situation.
Fastcgi_cache_valid 302 1h;
#用来指定应答代码的缓存时间, the value in the instance indicates that 200 and 302 are cached for one hours
Fastcgi_cache_valid 301 1d;
#将 301 Answer Cache for 1 days
Fastcgi_cache_valid any 1m;
#将其它应答缓存为 1 minutes
Fastcgi_cache_min_uses 1;
#缓存在 fastcgi_cache_path Instruction inactive the minimum number of usage times in the parameter value time
This article from "thinking More than technology" blog, declined reprint!
PHP in FastCGI