nginx 压测502 504错误
程序员文章站
2022-05-13 16:00:45
...
项目进行压测频繁有502 504错误通过各种排查终于找到了问题的所在,由于tcp访问超时导致
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
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教程有兴趣的朋友有所帮助。
推荐阅读
-
Yii框架使用xhprof会在nginx下报502 Bad Gateway错误
-
nginx-php5-fpm - Nginx + PHP(php-fpm)遇到的502 Bad Gateway 错误,该如何解决,有哪些方法?
-
502 - php的phalcon框架502 Bad Gateway错误,nginx环境
-
nginx-php5-fpm - 当nginx显示502 Bad Gateway错误,如何实现用户无感知的自动重启php-fpm
-
PHP脚本监控Nginx 502错误并自动重启php-fpm
-
详解php+nginx 服务发生500 502错误排查思路
-
详解Nginx 502错误解决办法
-
502 - php的phalcon框架502 Bad Gateway错误,nginx环境
-
将PHP从5.3.28升级到5.3.29时Nginx出现502错误,5.3.29nginx
-
django+uwsgi+nginx - 错误:nginx:504 Gateway Time out