nginx 压测502 504错误

项目进行压测频繁有502 504错误通过各种排查终于找到了问题的所在,由于tcp访问超时导致

nginx.conf 设置

  tcp_nodelay on;
  fastcgi_connect_timeout 600;
  fastcgi_send_timeout 600;
  fastcgi_read_timeout 600;
  fastcgi_buffer_size 64k;
  fastcgi_buffers 4 64k;
  fastcgi_busy_buffers_size 128k;
  fastcgi_temp_file_write_size 128k;



nginx proxy: connect() to ip:80 failed (99: Cannot assign requested address)


modify /etc/sysctl.conf:

net.ipv4.tcp_timestamps = 1
net.ipv4.tcp_tw_recycle = 0
net.ipv4.tcp_tw_reuse = 1
net.ipv4.tcp_max_tw_buckets = 10000
net.ipv4.ip_nonlocal_bind = 1

sysctl -p



下面是 tcp的设置的介绍文章

http://blog.renhao.org/2010/07/setup-linux-kernel-tcp-settings/

你可能感兴趣的:(nginx 压测502 504错误)