nginx buffered to a temporary 解决

http://rickie622.blog.163.com/blog/static/2123881120116185123407/

今天开启了nginx的error_log,发现了三个配置问题:

问题一:
2011/07/18 17:04:37 [warn] 2422#0: *171505004 an upstream response is buffered to a temporary file /opt/app/nginx/fastcgi_temp/9/80/0001539809 while reading upstream, client: 1.202.221.2, server: www.yongfu.com, request: “GET /recipe/all?cate=643&PHPSESSID=8c1135b85f1b5f90f55caab5ea7e1526 HTTP/1.0”, upstream: “fastcgi://127.0.0.1:9000”, host: “www.yongfu.com”
问题分析:nginx的fastcgi设置的fastcgi_buffers太小,导致将缓存写入磁盘。
问题解决:修改nginx的配置,将fastcgi_buffers调大,参考了该文:http://www.ruby-forum.com/topic/140625
fastcgi_buffers 32 8k;
ok,问题解决,但又出现新的问题:
问题二:
2011/07/18 17:10:21 [warn] 2898#0: *171505297 a client request body is buffered to a temporary file /opt/app/nginx/client_body_temp/0001539931, client: 114.237.110.152, server: www.yongfu.com, request: “POST /recipe/create/58884?do=uploadstep HTTP/1.1”, host: “www.yongfu.com”, referrer: “http://www.yongfu.com/recipe/create/58884”
问题分析:还是缓存写入磁盘的问题。
问题解决:修改nginx.conf的client_max_body_size & client_body_buffer_size选项。参考了:http://nginx.org/pipermail/nginx/2009-July/013634.html
client_max_body_size 500m;
client_body_buffer_size 1024k;
问题三:
2011/07/18 16:43:39 [warn] 18326#0: *28601 using uninitialized “rule_1” variable, client: 192.168.1.6, server: yongfu.com, request: “GET /user/notice.php?callback=jsonp1310978365248&_=1310978696380 HTTP/1.1”, host: “www.yongfu.com”, referrer: “http://www.yongfu.com/act/cooking?m=creview”
问题分析:这个是因为我的rewrite规则里的变量rule_1的问题。
if (!-f $document_root$uri){
set $rule_1 “1”;
}
if ($rule_1 = “1”){
rewrite ^/.*$ /rewrite.php last;
}
说是没有定义rule_1,但我在那里定义了呀,没明白。但分析这两个判断,可以使用以下代码代替:
问题解决:
if (!-f $document_root$uri){
rewrite ^/.*$ /rewrite.php last;
}
分享到: 更多 (0)