Nginx超时499状态

sloan

问题描述

接口实际请求时间:2024-08-08 18:43:05.454
webman程序开始处理时间:2024-08-08 18:43:10.486
webman程序结束处理时间:2024-08-08 18:43:10.537
nginx的日记:"timestamp": "2024-08-08T18:43:10+08:00",,"response_status": "499","request_time": "4.938","upstream_response_time": "4.938"
出现概率万分之五,5秒超时,客户端会主动断开连接,请问我应该如何减少超时次数的发生?

Nginx反向代理

upstream webman {
    server 127.0.0.1:8788;
    keepalive 4000;
    keepalive_requests 2000;
}
server {
    server_name api-demo.com;
    listen 80;
    listen 443 ssl http2;
    ssl_certificate /etc/nginx/ssl/api-demo.com.pem;
    ssl_certificate_key /etc/nginx/ssl/api-demo.com.key;
    ssl_session_cache shared:SSL:50m;
    ssl_session_timeout 1h;
    ssl_protocols TLSv1.2 TLSv1.3;
    ssl_stapling on;
    ssl_stapling_verify on;
    ssl_trusted_certificate /etc/nginx/ssl/api-demo.com.pem;
    resolver 8.8.8.8 8.8.4.4 valid=300s;
    resolver_timeout 5s;
    ssl_buffer_size 4k;
    ssl_prefer_server_ciphers on;
    ssl_ciphers 'EECDH+AESGCM:EDH+AESGCM:AES256+EECDH:AES256+EDH';

    location ^~ / {
        if ($host ~* "^(\d{1,3}\.){3}\d{1,3}$") {
            return 403;
        }
        proxy_set_header remote_addr $remote_addr;
        proxy_set_header Host $host;
        proxy_set_header X-Forwarded-Proto $scheme;
        proxy_http_version 1.1;
        proxy_set_header Connection "";
        if (!-f $request_filename){
            proxy_pass http://webman;
        }
    }
    access_log /data/logs/nginx/api-demo.log vector;
    error_log /data/logs/nginx/api-demo-error.log;
}
278 0 0
0个回答

×
🔝