1、查看當前的PHP FastCGI進程數是否夠用:
netstat -anpo | grep "php-cgi" | wc -l
or
netstat -anpo | grep "php-fpm" | wc -l
如果實際使用的“FastCGI進程數”接近預設的“FastCGI進程數”,那麼,說明“FastCGI進程數”不夠用,需要增大。
2、部分PHP程序的執行時間超過了Nginx的等待時間,可以適當增加nginx.conf配置文件中FastCGI的timeout時間,例如:
......
http
{
......
fastcgi_connect_timeout 300;
fastcgi_send_timeout 300;
fastcgi_read_timeout 300;
......
}
......
以下是我的設定檔範例
location ~ \.php$ {
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_connect_timeout 300;
fastcgi_send_timeout 300;
fastcgi_read_timeout 300;
include fastcgi_params;
}
參考資料:http://blog.s135.com/read.php/361/