nginx出错:upstream sent too big header

vps里查看nginx日志出现upstream sent too big header while reading response header from upstream错误。

1、反向代理端,可以放到server中:
        client_header_buffer_size 128k;
        large_client_header_buffers 4 128k;
        proxy_buffer_size 64k;
        proxy_buffers 8 64k;
        fastcgi_buffer_size 128k;
        fastcgi_buffers 4 128k;

  主要是proxy的那组参数,网上的解决这三方面都有。

2、web-server:
最主要的是fastcgi那组。

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

转载于:https://my.oschina.net/mickelfeng/blog/160631

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值