3、一般用16k足够。
sudo gedit /var/log/nginx/error.log
查看错误日志upstream sent too big header while reading response header from upstream
你去搜这个错误,网上的解释都差不多,无外乎是cookie携带的header太多了,让你设置:
fastcgi_buffer_size 128k;
fastcgi_buffers 8 128k;
逐步尝试。其中fastcgi_buffers 8 128k 这句,fastcgi_buffers 32 32k 这样更好,内存是整块分配和释放的,减少单位k数能尽可能利用。
另外,如果你用nginx做负载均衡的话,改了上述参数是没用的,要在转发的配置上,比如以下设置:
location @to_other {
proxy_buffer_size 128k;
proxy_buffers 32 32k;
proxy_busy_buffers_size 128k;
add_header X-Static transfer;
proxy_redirect off;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_pass http://backend; #请求转发
}
加粗的三行才会起作用。
fastcgi_* 可以理解成nginx接受client请求时的响应使用的。proxy是nginx作为client转发时使用的,如果header过大,超出了默认的1k,就会引发上述的upstream sent too big header。
可以参考:
http://wiki.nginx.org/NginxHttpProxyModule
http://blog.sina.com.cn/s/blog_5dc960cd0100i4mt.html
其它搜索结果可以无视,都是大同小异的。
location ~ \.php$ {
fastcgi_buffer_size 128k;
fastcgi_buffers 32 32k;
include /etc/nginx/fastcgi_params;
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME /host/web/$fastcgi_script_name;
}
2013/09/11 05:38:04 [error] 21084#0: *1118 FastCGI sent in stderr: "PHP message: WordPress数据库查询update wp_autopost_task set last_update_time = 1378906684 where id=时发生You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '' at line 1错误,这是由shutdown_action_hook, do_action('shutdown'), call_user_func_array, update_after_page_load, ap_checkupdate查询的。 PHP message: WordPress数据库查询SELECT is_running FROM wp_autopost_task WHERE id = 时发生You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '' at line 1错误,这是由shutdown_action_hook, do_action('shutdown'), call_user_func_array, update_after_page_load, ap_checkupdate, fetch, getIsRunning查询的。 PHP message: WordPress数据库查询update wp_autopost_task set is_running = 1 where id=时发生You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '' at line 1错误,这是由shutdown_action_hook, do_action('shutdown'), call_user_func_array, update_after_page_load, ap_checkupdate, fetch, updateRunning查询的。 PHP message: WordPress数据库查询update wp_autopost_task set last_update_time = 1378906684 where id=时发生You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '' at line 1错误,这是由shutdown_action_hook, do_action('shutdown'), call_user_func_array, update_after_page_load, ap_checkupdate, fetch, updateTaskUpdateTime查询的。 PHP message: WordPress数据库查询SELECT url FROM wp_autopost_task_urllist WHERE config_id = ORDER BY id时发生You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'ORDER BY id' at line 1错误,这是由shutdown_action_hook, do_action('shutdown'), call_user_func_array, 2013/09/11 05:38:04 [error] 21084#0: *1118 upstream sent too big header while reading response header from upstream, client: 222.212.49.153, server: www.php100.me, request: "POST /wp-login.php HTTP/1.1", upstream: "fastcgi://127.0.0.1:9000", host: "www.php100.me", referrer: "http://www.php100.me/wp-login.php?redirect_to=http%3A%2F%2Fwww.php100.me%2Fwp-admin%2Fedit.php&reauth=1" 2013/09/11 05:38:04 [error] 21084#0: *1118 FastCGI sent in stderr: "PHP message: WordPress数据库查询update wp_autopost_task set last_update_time = 1378906684 where id=时发生You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '' at line 1错误,这是由shutdown_action_hook, do_action('shutdown'), call_user_func_array, update_after_page_load, ap_checkupdate查询的。 PHP message: WordPress数据库查询SELECT is_running FROM wp_autopost_task WHERE id = 时发生You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '' at line 1错误,这是由shutdown_action_hook, do_action('shutdown'), call_user_func_array, update_after_page_load, ap_checkupdate, fetch, getIsRunning查询的。 PHP message: WordPress数据库查询update wp_autopost_task set is_running = 1 where id=时发生You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '' at line 1错误,这是由shutdown_action_hook, do_action('shutdown'), call_user_func_array, update_after_page_load, ap_checkupdate, fetch, updateRunning查询的。 PHP message: WordPress数据库查询update wp_autopost_task set last_update_time = 1378906684 where id=时发生You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '' at line 1错误,这是由shutdown_action_hook, do_action('shutdown'), call_user_func_array, update_after_page_load, ap_checkupdate, fetch, updateTaskUpdateTime查询的。 PHP message: WordPress数据库查询SELECT url FROM wp_autopost_task_urllist WHERE config_id = ORDER BY id时发生You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'ORDER BY id' at line 1错误,这是由shutdown_action_hook, do_action('shutdown'), call_user_func_array, 2013/09/11 05:38:06 [error] 21084#0: *1118 FastCGI sent in stderr: "PHP message: WordPress数据库查询update wp_autopost_task set last_update_time = 1378906686 where id=时发生You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '' at line 1错误,这是由shutdown_action_hook, do_action('shutdown'), call_user_func_array, update_after_page_load, ap_checkupdate查询的。 PHP message: WordPress数据库查询SELECT is_running FROM wp_autopost_task WHERE id = 时发生You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '' at line 1错误,这是由shutdown_action_hook, do_action('shutdown'), call_user_func_array, update_after_page_load, ap_checkupdate, fetch, getIsRunning查询的。 PHP message: WordPress数据库查询update wp_autopost_task set is_running = 1 where id=时发生You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '' at line 1错误,这是由shutdown_action_hook, do_action('shutdown'), call_user_func_array, update_after_page_load, ap_checkupdate, fetch, updateRunning查询的。 PHP message: WordPress数据库查询update wp_autopost_task set last_update_time = 1378906686 where id=时发生You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '' at line 1错误,这是由shutdo" while reading upstream, client: 222.212.49.153, server: www.php100.me, request: "GET /wp-login.php HTTP/1.1", upstream: "fastcgi://127.0.0.1:9000", host: "www.php100.me" 2013/09/11 05:38:06 [error] 21084#0: *1118 FastCGI sent in stderr: "wn_action_hook, do_action('shutdown'), call_user_func_array, update_after_page_load, ap_checkupdate, fetch, updateTaskUpdateTime查询的。 PHP message: WordPress数据库查询SELECT url FROM wp_autopost_task_urllist WHERE config_id = ORDER BY id时发生You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'ORDER BY id' at line 1错误,这是由shutdown_action_hook, do_action('shutdown'), call_user_func_array, update_after_page_load, ap_checkupdate, fetch, getListUrls查询的。 PHP message: WordPress数据库查询SELECT * FROM wp_autopost_task WHERE id =时发生You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '' at line 1错误,这是由shutdown_action_hook, do_action('shutdown'), call_user_func_array, update_after_page_load, ap_checkupdate, fetch, getConfig查询的。 PHP message: WordPress数据库查询insert into wp_autopost_log(config_id,date_time,info,url) values (,1378906686,"[文章来源网址]还未设置","")时发生You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '1378906686,"[文章来源网址]还未设置","")' at line 1错误,这是由shutdown_action_hook, do_action('shutdown'), call_user_func_array, update_after_page_load, ap_checkupdate, fetch, errorLog查询的。 PHP message: WordPress数据库查询update wp_autopost_task set last_error = 0 where id=时发生You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '' at line 1错误,这是由shutdown_action_hook, do_action('shutdown'), call_user_func_array, update_after_page_load, ap_checkupdate, fetch, updateConfigErr查询的。" while reading upstream, client: 222.212.49.153, server: www.php100.me, request: "GET /wp-login.php HTTP/1.1