I am getting connection reset with Nginx when the client has a slow connection. This is just a static http website...no back ends. Any ideas how to stop the connection resets on slow connections? I tried playing with the timeout
values but haven't found success.
In the log, I see this error:
2015/09/21 17:11:57 [info] 8704#0: *44 client prematurely closed connection while sending response to client
events {
worker_connections 128;
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"';
client_header_timeout 12s;
client_body_timeout 12s;
send_timeout 10s;
keepalive_timeout 15s;
# open_file_cache max=1s inactive=1s;
#open_file_cache max=500 inactive=600s;
# open_file_cache_valid 300s;
open_file_cache_errors on;
expires 24h;
client_max_body_size 20m;
connection_pool_size 256;
client_header_buffer_size 1k;
large_client_header_buffers 4 2k;
request_pool_size 4k;
gzip on;
gzip_min_length 1100;
gzip_buffers 4 8k;
gzip_types text/plain;
output_buffers 1 32k;
postpone_output 1460;
sendfile on;
tcp_nopush on;
tcp_nodelay on;
ignore_invalid_headers on;
server_tokens off;
index index.html index.php;
The client is closing the connection, not your server. This has nothing to do with any of the server timeout settings.
The only way to prevent this is to make your server faster and therefore less likely that the client will give up waiting for it to respond. Note that a small number of these errors is perfectly normal (it's flagged as
info
in the nginx log after all) as users are generally a fairly impatient bunch.