欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页  >  后端开发

nginx 压测502 504错误

程序员文章站 2022-05-06 22:28:46
...
项目进行压测频繁有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错误,包括了方面的内容,希望对PHP教程有兴趣的朋友有所帮助。