To optimize the performance parameter settings, add the FastCGI parameter to the HTTP layer of ngnix. conf as follows:
HTTP {
Fastcgi_cache_path/usr/local/nginx/fastcgi_cache levels = keys_zone = test: 10 m inactive = 5 m;
Fastcgi_connect_timeout = 300;
Fastcgi_send_timeout = 300;
Fastcgi_buffer_size = 64 K;
Fastcgi_buffers 4 64 K;
Fastcgi_busy_buffers_size 128 K;
Fastcgi_temp_file_write_size 128 K;
Fastcgi_cache test;
Fastcgi_cache_valid 200 302 1 h;
Fastcgi_cache_valid 301 1D;
Fastcgi_cache_valid any 1 m;
}
Fastcgi_cache_path/usr/local/nginx/fastcgi_cache levels = keys_zone = test: 10 m inactive = 5 m; # cache path file, directory structure level, actual and inactive time of keyword Area
Fastcgi_connect_timeout = 300; # connection to backend FastCGI timeout
Fastcgi_send_timeout = 300; # request timeout to FastCGI (This specified value has already completed two handshakes and sent the request timeout to FastCGI)
Fastcgi_rend_timeout = 300; # The timeout time for receiving the FastCGI response. Likewise, after two handshakes
Fastcgi_buffer_size = 64 K; # size of the buffer required to read the first part of the FastCGI response. This value indicates that a 64kb buffer is used to read the first part of the response (Response Header) and can be set to the buffer size of the fastcgi_buffers Option
Fastcgi_buffers 4 64 K; # specify the number of local and large buffers to buffer FastCGI response requests. Assume that the size of the page generated by a PHP or Java Script is kb, 4 64kb buffers will be allocated for the cache. If the page is larger than kb, the portion larger than kb will be cached in the path specified by fastcgi_temp. This is not a good solution, memory Data Processing is faster than hard disk data. Generally, this value should be the median value of the page size generated by PHP/java scripts on the site. If the page size generated by most scripts on the site is kb, you can set the value to 16 K, 4 64 K, etc.
Fastcgi_busy_buffers_size 128 K; # The default value is twice that of fastcgi_buffer.
Fastcgi_temp_file_write_size 128 K; # the size of the data block used to write the cached file. The default value is twice that of fastcgi_buffer.
Fastcgi_cache test; # enable the FastCGI cache and specify it as the test name to reduce the CPU load and prevent 502 errors.
# Response code cache time. The 200 and 302 responses are cached for 1 hour, 301 days, and the other 1 minute.
Fastcgi_cache_valid 200 302 1 h;
Fastcgi_cache_valid 301 1D;
Fastcgi_cache_valid any 1 m;