nginx出錯:upstream sent too big header

vps裏查看nginx日誌出現upstream sent too big header while reading response header from upstream錯誤。

一、反向代理端,能夠放到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的那組參數,網上的解決這三方面都有。

二、web-server:
最主要的是fastcgi那組。

三、通常用16k足夠。 php

sudo gedit /var/log/nginx/error.log html

查看錯誤日誌

upstream sent too big header while reading response header from upstream nginx

你去搜這個錯誤,網上的解釋都差很少,無外乎是cookie攜帶的header太多了,讓你設置: web

fastcgi_buffer_size 128k;
fastcgi_buffers 8 128k; 數據庫

逐步嘗試。其中fastcgi_buffers 8 128k 這句,fastcgi_buffers 32 32k 這樣更好,內存是整塊分配和釋放的,減小單位k數能儘量利用。 cookie

另外,若是你用nginx作負載均衡的話,改了上述參數是沒用的,要在轉發的配置上,好比如下設置: 負載均衡

location @to_other { post

                proxy_buffer_size  128k; fetch

                proxy_buffers   32 32k; url

                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
相關文章
相關標籤/搜索