Re: client closed prematurely connection × ÒÅÖÉÍÅ proxy

Denis F. Latypoff latypoff ÎÁ yandex.ru
ðÔ áÐÒ 27 10:50:22 UTC 2012


27.04.2012, 17:46, "Sergey Kobzar" <sergey.kobzar at itcraft.org>:
> Nginx × ÒÅÖÉÍÅ ÐÒÏËÓÉ (ÆÒÏÎÔÜÎÄ):
>
> user nginx nginx;
> worker_processes 24;
>
> error_log /var/log/nginx/error.log info;
>
> events {
> šššššššššworker_connections 1024;
> šššššššššuse epoll;
> }
>
> http {
> šššššššššinclude /etc/nginx/mime.types;
> šššššššššdefault_type application/octet-stream;
>
> šššššššššlog_format main
> ššššššššššššššššš'$remote_addr - $remote_user [$time_local] '
> ššššššššššššššššš'"$request" $status $bytes_sent '
> ššššššššššššššššš'"$http_referer" "$http_user_agent" '
> ššššššššššššššššš'"$gzip_ratio" '
> ššššššššššššššššš'$upstream_addr $upstream_status';
>
> šššššššššclient_header_timeout 10m;
> šššššššššclient_body_timeout 10m;
> ššššššššškeepalive_timeout 75 20;
> šššššššššsend_timeout 10m;
> šššššššššserver_tokens off;
> šššššššššclient_max_body_size 40m;
>
> šššššššššsendfile on;
> ššššššššštcp_nopush on;
>
> šššššššššproxy_buffer_size 128k;
> šššššššššproxy_buffers 8 64k;
> šššššššššproxy_connect_timeout 5;
> šššššššššproxy_intercept_errors on;
>
> šššššššššset_real_ip_from 127.0.0.1;
> šššššššššreal_ip_header X-Real-IP;
>
> šššššššššupstream backend {
> šššššššššššššššššserver 10.17.92.2 šmax_fails=3 fail_timeout=300s;
> šššššššššššššššššserver 10.17.92.12 max_fails=3 fail_timeout=300s;
> šššššššššššššššššserver 127.0.0.1 backup;
> šššššššššššššššššip_hash;
> ššššššššš}
>
> šššššššššupstream backend_static {
> šššššššššššššššššserver 10.17.92.2 šmax_fails=3 fail_timeout=300s;
> šššššššššššššššššserver 10.17.92.12 max_fails=3 fail_timeout=300s;
> šššššššššššššššššserver 127.0.0.1 backup;
> ššššššššš}
>
> šššššššššserver {
> šššššššššššššššššlisten 127.0.0.1;
> šššššššššššššššššserver_name localhost;
>
> šššššššššššššššššaccess_log /var/log/nginx/localhost_access.log main;
> šššššššššššššššššerror_log /var/log/nginx/localhost_error.log info;
>
> šššššššššššššššššlocation / {
> šššššššššššššššššššššššššerror_page 502 504 /errors/500.html;
> šššššššššššššššššššššššššreturn 500;
> ššššššššššššššššš}
>
> šššššššššššššššššlocation ^~ /errors/ {
> šššššššššššššššššššššššššroot /home/www/localhost/htdocs;
> šššššššššššššššššššššššššexpires max;
> ššššššššššššššššš}
> ššššššššš}
>
> šššššššššserver {
> šššššššššššššššššlisten 80 default;
> šššššššššššššššššserver_name localhost;
>
> šššššššššššššššššaccess_log /var/log/nginx/default_access.log main;
> šššššššššššššššššerror_log /var/log/nginx/default_error.log info;
>
> šššššššššššššššššlocation / {
> šššššššššššššššššššššššššproxy_pass http://backend;
>
> šššššššššššššššššššššššššproxy_set_header Host $host;
> šššššššššššššššššššššššššproxy_set_header X-Real-IP $remote_addr;
> šššššššššššššššššššššššššproxy_set_header X-Forwarded-For
> $proxy_add_x_forwarded_for;
> ššššššššššššššššš}
>
> šššššššššššššššššerror_page 500 502 504 /errors/500.html;
>
> šššššššššššššššššlocation ^~ /errors/ {
> šššššššššššššššššššššššššroot /home/www/localhost/htdocs;
> šššššššššššššššššššššššššexpires max;
> ššššššššššššššššš}
> ššššššššš}
>
> îÁ ÆÒÏÎÔÜÎÄÅ:
> 66.249.73.15 - - [27/Apr/2012:11:23:22 +0100] "GET ... HTTP/1.1" 504
> 9700 "-" "Mozilla/5.0 (compatible; Googlebot/2.1;
> +http://www.google.com/bot.html)" "-" 10.17.92.12:80, 10.17.92.2:80 504, 504
> 66.249.73.209 - - [27/Apr/2012:11:23:23 +0100] "GET ... HTTP/1.1" 504
> 9700 "-" "Mozilla/5.0 (compatible; Googlebot/2.1;
> +http://www.google.com/bot.html)" "-" 10.17.92.12:80, 10.17.92.2:80 504, 504
> 66.249.73.15 - - [27/Apr/2012:11:23:23 +0100] "GET ... HTTP/1.1" 500
> 9676 "-" "SAMSUNG-SGH-E250/1.0 Profile/MIDP-2.0 Configuration/CLDC-1.1
> UP.Browser/6.2.3.3.c.1.101 (GUI) MMP/2.0 (compatible;
> Googlebot-Mobile/2.1; +http://www.google.com/bot.html)" "-" 127.0.0.1:80 500
>
> îÁ ÂÜËÅÎÄÅ ÎÁ ÔÏÔ ÖÅ ÚÁÐÒÏÓ:
> access log:
> 66.249.73.15 - - [27/Apr/2012:11:23:22 +0100] "GET ... HTTP/1.0" 499 0
> "-" "Mozilla/5.0 (compatible; Googlebot/2.1;
> +http://www.google.com/bot.html)" "-"
>
> error_log:
> 2012/04/27 11:23:22 [info] 9804#0: *206566 client closed prematurely
> connection, so upstream connection is closed too while sending request
> to upstream, client: 66.249.73.15, server: localhost, request: "GET ...
> HTTP/1.0", upstream: "fastcgi://127.0.0.1:9001", host: "www.test.com"
>
> ô.Å. ÏÂÝÁÑ ËÁÒÔÉÎÁ:
>
> 1. ëÌÉÅÎÔ ÚÁËÒÙÌ ÓÏÅÄÉÎÅÎÉÅ - ÎÁ ÂÜËÅÎÄÅ ÐÏÌÕÞÉÌÉ 499
> 2. ÷ÅÒÎÕÌÉ ÆÒÏÎÔÅÎÄÕ 504
> 3. 3 ÐÏÄÏÂÎÙÅ ÓÉÔÕÁÃÉÉ É ÂÜËÜÎÄ ×ÙËÉÄÙ×ÁÅÍ ÉÚ ÐÕÌÁ
>
> ëÁË-ÔÏ ÜÔÏ ÎÅÐÒÁ×ÉÌØÎÏ IMO. ô.Å. ÎÅÓËÏÌØËÏ ËÌÉÅÎÔÏ× ÚÁËÒÙ×ÛÉÈ ÓÏÅÄÉÎÅÎÉÅ
> ÍÏÇÕÔ ÚÁ×ÁÌÉÔØ ×ÓÀ ÓÉÓÔÅÍÕ. õÍÅÎØÛÁÔØ max_fails=3 fail_timeout=300s ÎÅ
> ÈÏÞÕ, Ô.Ë ÅÓÌÉ ÏÄÉÎ ÉÚ ÂÜËÖÎÄÏ× ÄÅÊÓÔ×ÉÔÅÌØÎÏ × ÄÁÕÎÅ, ÎÁÞÉÎÁÀÔÓÑ ÐÒÏÂÌÅÍÙ.
>
> ëÁË ÐÒÁ×ÉÌØÎÏ ÒÅÛÉÔØ ÐÏÄÏÂÎÕÀ ÓÉÔÕÁÃÉÀ?
>

http://nginx.org/en/docs/http/ngx_http_proxy_module.html#proxy_ignore_client_abort

> óÐÁÓÉÂÏ.
>

-- 
br, Denis F. Latypoff.



ðÏÄÒÏÂÎÁÑ ÉÎÆÏÒÍÁÃÉÑ Ï ÓÐÉÓËÅ ÒÁÓÓÙÌËÉ nginx-ru